Forum Discussion
AnthonyDavisSF
Sep 20, 2023Copper Contributor
Workbook reference returns subscript out of range error
Bit embarrassing, but here I am... Currently struggling up the cliff that is self-learning VBA via yt and google while simultaneously trying to create a usable macro and I feel like I'm missing s...
- Sep 20, 2023
Replace the two lines
Workbooks.Open ("C:\Users\Anthony\SynologyDrive\Foldername\Sample Tracker.xlsx")
Set Trackingwbk = Workbooks("C:\Users\Anthony\SynologyDrive\Foldername\Sample Tracker.xlsx")
with
Set Trackingwbk = Workbooks.Open ("C:\Users\Anthony\SynologyDrive\Foldername\Sample Tracker.xlsx")
HansVogelaar
Sep 20, 2023MVP
Can you explain the following part?
Rows(iRowlocation).EntireRow.Insert inserts a row on Trackingwsh (the active sheet) whose row number is iRowlocation, i.e. the value of cell A1 on Trackingwsh.
So for example if A1 on Trackingwsh contains the number 37, and if iCount = 6, you'll insert a new row in row 37 six times. Is that your intention?