PDA

View Full Version : Solved: Range("e1").Row = 5 not e



clarksonneo
09-13-2011, 12:55 PM
Hi,

If I want the value of cell A1 to be e, then the following code is correct.
Range("a1").Value = Range("e1").column

My question is that
If I want the value of cell A1 to be 5, what is the correct code?

I know that range("a1").value="e" is fine, but I have reason that requires the code has the form I need.
Ie, Range("a1").Value = Range("e1").??????

Thanks

Bob Phillips
09-13-2011, 01:32 PM
I guess that you don't mean

Range("A1").Value = 5

mancubus
09-13-2011, 03:00 PM
not clear.
i you are wanting to populate A1 with the column letter of a cell then
Range("A1").Value = Left(Range("E1").Address(1, 0), InStr(1, Range("E1").Address(1, 0), "$") - 1)

clarksonneo
09-13-2011, 10:50 PM
not clear.
i you are wanting to populate A1 with the column letter of a cell then
Range("A1").Value = Left(Range("E1").Address(1, 0), InStr(1, Range("E1").Address(1, 0), "$") - 1)


thank you this is exactly what I need.

I have to say sorry, because the title of this thread is wrong.
The correct one is
range("e1").column = 5 not e

mancubus
09-13-2011, 11:14 PM
you're wellcome.

please mark the thread as "solved" from "Thread Tools" dropdown on top of the page.