Boomer1962
New Member
- Joined
- Jul 4, 2023
- Messages
- 10
- Office Version
- 365
- Platform
- Windows
I have data in a source worksheet in rows. The number of rows and columns will vary so I must refer to them dynamically. The first column contains store numbers which are the Tab Names in my destinations workbook.
I only need to properly identify the destination Tab Name from the list in the source worksheet in order to copy the data in the subsequent columns.
I have this so far but I am getting errors.
My problem is how do I identify the Sheets(????) so that the destination Worksheet changes with each iteration of my loop?
I only need to properly identify the destination Tab Name from the list in the source worksheet in order to copy the data in the subsequent columns.
I have this so far but I am getting errors.
VBA Code:
Dim Store As String
Dim s As Long
Dim wsDest As Worksheet
Dim lrDest As Long
Dim Qty As Long
Dim sheetname As String
For s = 7 To lr
Application.Calculation = xlCalculationManual
Set wsDest = Workbooks("Copie de Facturation Juillet 2023 2.xlsx").Sheets(??????)
For c = storecol + 1 To lc
lrDest = wsDest.Cells(wsDest.Rows.Count, "A").End(xlUp).Offset(1).Row
Qty = Cells(s, c).Value
wsDest.Cells(lrDest, 4).Value = Qty
Next
Next
My problem is how do I identify the Sheets(????) so that the destination Worksheet changes with each iteration of my loop?