albytross
New Member
- Joined
- Sep 22, 2021
- Messages
- 24
- Office Version
- 365
Hi all,
I have this code which almost does exactly what I need it to.
Instead of populating cells with the word Test, how could i make it populate cells with the exact value on worksheet ABC, cell A2?
I have this code which almost does exactly what I need it to.
Instead of populating cells with the word Test, how could i make it populate cells with the exact value on worksheet ABC, cell A2?
VBA Code:
Sub Sample()
Dim ws As Worksheet
Dim lRow As Long
Set ws = ThisWorkbook.Sheets("XYZ")
With ws
lRow = .Range("C" & .Rows.Count).End(xlUp).Row
.Range("B2:B" & lRow).Formula = "=If(C2<>"""",""Test"","""")"
.Range("B2:B" & lRow).Value = .Range("B2:B" & lRow).Value
End With
End Sub