cells.End(xltoright) Not working

abeed

Board Regular
Joined
Nov 19, 2005
Messages
79
Hi: My data (in a excel sheet) are like this.

v37426 1.17135907 1.19648498 1.17981816----row number 2 here

My firt cell is cells(2,1) with data v37426
2nd cell is cells(2,2) with data 1.17135907

I was trying to use:
dim cn as integer
cn = cells(2,1).end(xltoright).column which is supposed to give me cn =2
But its giving me cn =192(which is the last data cell in this row.

if I am wrong what should I do to get column number of the next available cell(with data) from my active cell(say cells(2,1) is active) . The result in this case will be 2.
Thanks
 

Some videos you may like

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

jindon

MrExcel MVP
Joined
Aug 21, 2004
Messages
16,995
It shouldn't give you 2

End property will give you the last cell which is not blank.
 

Watch MrExcel Video

Forum statistics

Threads
1,118,118
Messages
5,570,282
Members
412,316
Latest member
JabirS
Top