Row Number and column Name in Vba

G2K

Active Member
Joined
May 29, 2009
Messages
355
Hi All,

how can we get row no and column name of spreadsheet object in VBa.

i want to check vaule of first cell of the column with a variable.

Let Activecell = H15

i want to check value of "H1" on command button click event.

please help.

thanks
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
There is a .Row and .Column property you can ask of a Range object.
Range("H15").Row will give you the row number of the cell.
You could also use the .Offset property. Depends a bit on what you are doing.
 
Upvote 0
Hi All,

how can we get row no and column name of spreadsheet object in VBa.

i want to check vaule of first cell of the column with a variable.

Let Activecell = H15

i want to check value of "H1" on command button click event.

please help.

thanks


Code:
Range(1,Activecell.Column).Value

Will give the value present in the 1st cell of column containing the selected cell.
<input id="gwProxy" type="hidden"><!--Session data--><input *******="jsCall();" id="jsProxy" type="hidden">
 
Upvote 0
thanks sandeep for Your quick reply,

I have tried it already and it is generateing error message " Run Time Error '5' Invalid use of command or property"

Spreadsheet1.Range(1, ActiveCell.Column).Value

Please note tht i m using Spreadsheet Object here

Thanks in advance
 
Upvote 0
It looks like the syntax for range is not correct, replace "Range" with "Cells".

Yeah....

Interchanged Range and Cell properties :biggrin:

shud be Cells(1,Activecell.Column)
<input id="gwProxy" type="hidden"><!--Session data--><input *******="jsCall();" id="jsProxy" type="hidden">
 
Upvote 0

Forum statistics

Threads
1,215,012
Messages
6,122,682
Members
449,091
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top