PDA

View Full Version : Solved: Count Total Columns used in Sheet



anandbohra
07-05-2007, 10:09 PM
Hi All,

Pl help me in getting total columns used in my worksheet through VBA code.
i got how to count total used rows but not getting for total column used.

the code for total rows used in sheet is

testrow = activesheet.Cells(Rows.Count, 1).End(xlUp).Row

pl tell me the code in same way for getting total column used in sheet

awaiting for your reply.

johnske
07-05-2007, 10:20 PM
ActiveSheet.Cells(1, Columns.Count).End(xlToLeft).Column

anandbohra
07-05-2007, 10:22 PM
thanks johnske
actually i was using xlleft instead of xltoleft & hence continuously getting error.


thanks for such quick reply.

johnske
07-05-2007, 10:32 PM
... i was using xlleft instead of xltoleft & hence continuously getting error...That's a very common mistake :)