ColumnIndex

T

tpapaj

Hi,

how can i get ColumnIndex of Activated Cell(by user)?

My problem is:

I have sheet, on sheet is button, user activate(click on) the cell
for example G5, then he push the button
The script must fill the cell A5(same row, first column) with curren
date...

To
 
B

Bob Phillips

Cell(Activecell.Column,"A")

points at that cell.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
J

Jim Rech

One way:

Range("A" & ActiveCell.Row).Value = Now

--
Jim Rech
Excel MVP
| Hi,
|
| how can i get ColumnIndex of Activated Cell(by user)?
|
| My problem is:
|
| I have sheet, on sheet is button, user activate(click on) the cell ,
| for example G5, then he push the button
| The script must fill the cell A5(same row, first column) with current
| date...
|
| Tom
|
|
| ---
|
|
 
J

Jim Rech

I bet you meant:

Cells(ActiveCell.Row, "A")

Didn't you, Bob<g>

--
Jim Rech
Excel MVP
|
| Cell(Activecell.Column,"A")
|
| points at that cell.
|
| --
|
| HTH
|
| Bob Phillips
| ... looking out across Poole Harbour to the Purbecks
| (remove nothere from the email address if mailing direct)
|
| | > Hi,
| >
| > how can i get ColumnIndex of Activated Cell(by user)?
| >
| > My problem is:
| >
| > I have sheet, on sheet is button, user activate(click on) the cell ,
| > for example G5, then he push the button
| > The script must fill the cell A5(same row, first column) with current
| > date...
| >
| > Tom
| >
| >
| > ---
| >
| >
|
|
 
B

Bob Phillips

Doh! My only excuse is that I saw through the OP's subject, but not all the
way.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
J

Jim Rech

Well, there's couple things to be aware of with your approach. One is that
it changes the active cell. You generally do not change the active cell
incidentally with a macro (unless you really want to).

The other thing is that the formula will not necessarily wind up in column
A. For example, if the active cell is G5 and there is an entry currently in
D5 (all other cells being empty) then the formula will go in D5, overwriting
what is there now.

--
Jim Rech
Excel MVP
| Or try . ..
| Selection.End(xlToLeft).Select
| ActiveCell.Formula = "=TODAY()"
|
|
| | > One way:
| >
| > Range("A" & ActiveCell.Row).Value = Now
| >
| > --
| > Jim Rech
| > Excel MVP
| > | > | Hi,
| > |
| > | how can i get ColumnIndex of Activated Cell(by user)?
| > |
| > | My problem is:
| > |
| > | I have sheet, on sheet is button, user activate(click on) the cell ,
| > | for example G5, then he push the button
| > | The script must fill the cell A5(same row, first column) with current
| > | date...
| > |
| > | Tom
| > |
| > |
| > | ---
| > |
| > |
| >
| >
|
|
 
Top