So i need to add 2021 to the Assessment year column in my worksheet but the range keeps breaking
LastRow is returning the correct value but i cant manage to figure out why range isnt working
Sub AutoFill()
Dim rFind As Range
Dim ColumnLetter As Variant
Dim ColumnNumber As Variant
Dim LastRow As Variant
Dim Fill As Range
With Range("A1:P1")
Set rFind = .Find(What:="AssessmentYear", LookAt:=xlWhole, MatchCase:=False, SearchFormat:=False)
If Not rFind Is Nothing Then
ColumnNumber = rFind.Column
ColumnLetter = Split(Cells(1, ColumnNumber).Address, "$")(1)
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
MsgBox ColumnLetter
MsgBox LastRow
Cells(LastRow, ColumnNumber).Value = "Here"
Range("ColumnLetter & 2 : ColumnLetter & LastRow").Value = "2021"
End If
End With
End Sub
I keep getting a method global failed error