My excel workbook contains a "Raw Data" sheet with a macro-assigned button. I want to parse the data in that sheet into corresponding sheets that has accompanying graphs in them after pressing the button. Below is the code that I am working on:
Public maxVoltage As Long
Public rowCount As Long
Sub RunAllMacros()
getData
parseData
End Sub
Sub getData()
Application.ScreenUpdating = False
maxVoltage = InputBox("Input nominal voltage (V).")
Range("B2").Select
Range(Selection, Selection.End(xlDown)).Select
rowCount = Selection.Count + 1
Application.ScreenUpdating = True
End Sub
Sub parseData()
Application.ScreenUpdating = False
Worksheets("Raw Data").Range(Cells(2, 2), Cells(rowCount, 2)).Copy _
Destination:=Worksheets("Voltage and Current").Range(Cells(2, 1), Cells(rowCount, 1))
Application.ScreenUpdating = True
End Sub
The getData() function is used to count the number of rows in the "Raw Data" sheet because the number of data may vary. The data will start in Column B with the top row serving as headings or names for the data. So the data will start in the 2nd row. My problem is that the syntax I use to copy and paste the data from the "Raw Data" sheet to the "Voltage and Current" sheet gives me Error 400. I do not know if this syntax does not accept variables as arguments in the 'Range' object. I will appreciate any help.