KaibleBasha
New Member
- Joined
- Aug 8, 2014
- Messages
- 36
Hi
I am trying to switch from counting Rows to counting columns in VBA and something isn't quite right.
This is what I have come up with (including comments for explanation)
Sub Faffing_Around()
Dim newCol As Integer
newCol = Cells(1, Columns.Count).End(xlLeft).Column + 1
'I have row one of three columns populated and need to automatically add new columns onto the end of this
'I frequently use this to count my rows and add another row after finding the last row & it works fine.
'e.g. of row count
'newRow = Cells(Rows.Count, "A").End(xlUp).Row + 1
'Columns.Count above = 16384
End Sub
Can you see where I am going wrong as I keep getting an application definied or Object defined error.
Thanks
Kai
I am trying to switch from counting Rows to counting columns in VBA and something isn't quite right.
This is what I have come up with (including comments for explanation)
Sub Faffing_Around()
Dim newCol As Integer
newCol = Cells(1, Columns.Count).End(xlLeft).Column + 1
'I have row one of three columns populated and need to automatically add new columns onto the end of this
'I frequently use this to count my rows and add another row after finding the last row & it works fine.
'e.g. of row count
'newRow = Cells(Rows.Count, "A").End(xlUp).Row + 1
'Columns.Count above = 16384
End Sub
Can you see where I am going wrong as I keep getting an application definied or Object defined error.
Thanks
Kai