jamec100x
New Member
- Joined
- Jan 17, 2022
- Messages
- 3
- Office Version
- 365
- 2019
- 2016
- 2013
- Platform
- Windows
- MacOS
In a workbook I have 2 sheets, let's just call them S1 and S2.
There is a set range of cells, "A14:Z38" on S1 that are either empty or contain column letters (a, b, c, etc).
I'd like to write a code that loops through each cell in that range on S1 and if that cell is not empty, finds the
value in S2 of the first cell of the referenced column. I'm getting an undefined object error.
Here's my code:
dim cll as range
For Each cll In ActiveWorkbooks.Sheets("S1").Range("A14:Z38").Cells
If IsEmpty(cll.Value) = False Then
cll.Value = ActiveWorkbooks.Sheets("S2").Range(cll.Value & 1)
End If
Next cll
There is a set range of cells, "A14:Z38" on S1 that are either empty or contain column letters (a, b, c, etc).
I'd like to write a code that loops through each cell in that range on S1 and if that cell is not empty, finds the
value in S2 of the first cell of the referenced column. I'm getting an undefined object error.
Here's my code:
dim cll as range
For Each cll In ActiveWorkbooks.Sheets("S1").Range("A14:Z38").Cells
If IsEmpty(cll.Value) = False Then
cll.Value = ActiveWorkbooks.Sheets("S2").Range(cll.Value & 1)
End If
Next cll