I am new to Excel VBA and I am working on a project which prints a report. I am getting an error when I run this excel VBA code. The error is at the "Columnoffset" line any help is appreciated. Thanks
Workbooks(MainWbName).Worksheets("DATA").Activate
rowoffset = DataRow - 1
' Activate WORKBOOK
Workbooks(MainWbName).Activate
Dim ColumnRangeName As String
Dim ColumnDefRange As Object
tabletouse = "ColumnDefinitions"
Sheettouse = "ColumnDefs"
Set ColumnDefRange = Worksheets(Sheettouse).Range(tabletouse)
If FieldTitle = " " Then Exit For
ColumnRangeName = WorksheetFunction.VLookup(FieldTitle, ColumnDefRange, 2, False)
Columnoffset = Range(ColumnRangeName).Value ' <-- Error
Workbooks(CSVFileName).Activate