How do I get Excel row number as variable?

  Simsy 11:19 02 Jun 2003

Hi folks….
I’m trying to write a piece of code that will insert a formula into a cell. The basic process is that the cell is selected and a button is clicked. A string is created, (containing variables which vary according to the row number of the cell), and then this is inserted into the cell.

I have 2 problems so I’ll use 2 threads..

How do I extract the Rownumber from the active cell to make it a variable?
I have tried;

'The row number of the active cell
Dim RNum As String
RNum = ActiveCell.Row

and many variations with no success

Thanks in advance,



  Simsy 11:59 02 Jun 2003

The site formatting didn't help with the display of my code....

what the above should have said was....

'The row number of the active cell

Dim RNum As String

RNum = ActiveCell.Row

In fact making RNum an Integer has solved that bit, but I need to find the column letter as well, which obviously isn't an integer. (I hadn't posted this part originally as I thought the solution would be the same for both row and column!)

Any more help is welcome.

Thanks in anticipation,



  Simsy 12:31 02 Jun 2003

the column letter is an integer, where,

A = 1

B = 2

C = 3

etc.... so this problem is solved!



  Tenner 12:44 02 Jun 2003

If all else fails, try click here and type in search <reference books> there are a couple on Excel at a reduced price - no experience of these books, but could be a start

Lidl sometimes have a cheap ref book on offer


  Simsy 16:57 02 Jun 2003

I have several at home in fact.... there is no budget for any more spending on Excel books! I was posting the above from work.

Anyway, I appreciate the link!



  barrie_g 18:25 02 Jun 2003

get "work" to buy some more books, put it down as on the job training and point out that the more your able to do the more productive you can be for your company.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

iPhone X review

Political cartoons in 2017: Chris Riddell, Rebecca Hendin and Dave Brown on what it’s like to…

The best iPhone for 2017

Tennis : comment regarder la finale de la Coupe Davis 2017 ?