This should be really simple, what am I doing wrong? The line counting columns does not work. I want to start in the specific cell and count the number of columns used to the right. Could only be 84 or 44.
VBA Code:
If Sheets("Flow_calculation").Range("AC228").End(xlRight).Columns.Count = 84 Then
Set PivotSource = Sheets("Flow_calculation").Range("AC228:DH275")
k = 44 + 40 ' number of columns
Else
Set PivotSource = Sheets("Flow_calculation").Range("AC228:BT275")
k = 44 ' number of columns
End If