How do I get Excel row number as variable?

  Simsy 11:19 02 Jun 2003
Locked

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,

Regards,

Simsy

  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,

Regards,

Simsy

  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!

Regards,

Simsy

  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!

Regards,

Simsy

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

Elsewhere on IDG sites

Huawei MateBook X Pro (2019) review

Inside the redesign of the world's largest computer games platform, Steam

Apple TV Plus streaming service launch, release date and price

Apple TV+ : date de sortie, prix et catalogue