I have a certain Loop in specific sub and module. I want to do the same action in a different sub and module with small change in the range where I paste the data, but it runs to me as an error. I tried to change the names of the variables for the range but it didn't work.
someone has ideas?
'part 3 - add new data as we did in the first sub
Dim Company As Range
Dim Companies As Range
Set Companies = ThisWorkbook.Worksheets("Data").Range("A2", Range("A2").End(xlDown))
For Each Company In Companies
With ThisWorkbook.Worksheets(Company.Value2)
.Activate
.Range("H2").End(xlDown).Select
.Range(Selection, Selection.End(xlToRight)).Copy
End With
With ThisWorkbook.Worksheets("Data")
.Activate
.Range("A2", Range("A2").End(xlDown)).Find(Company.Value2, , xlValues, xlWhole).Activate
End With
ActiveCell.Offset(0, 4).PasteSpecial (xlPasteValues)
Next Company
error in line:
Set Companies = ThisWorkbook.Worksheets("Data").Range("A2", Range("A2").End(xlDown))
ThisWorkbook.Worksheets("ðúåðéí").Range("A2", Range("A2").End(xlDown))
toThisWorkbook.Worksheets("ðúåðéí").Range(ThisWorkbook.Worksheets("ðúåðéí").Range("A2"), ThisWorkbook.Worksheets("ðúåðéí").Range("A2").End(xlDown))
– eirikdaude