#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 133
Default VBA syntax

how do i select the current cell im in .. in vba
lets say, im in B3 and edit the value - im working on a code that will say:
- in Row 3, check and recalculate D3 if necessary(which uses VBA to create a
validated list based on a loop... so i can't just use formulas)
if in row 4, check and recalculate D4.

so.. i need to be able to get the number of the row im in.. so i can set it
to a variable and go from there

any help?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default VBA syntax

Msgbox Activecell.Row
Activecell.Column
Activecell.Address

If this post helps click Yes
---------------
Jacob Skaria


"Derrick" wrote:

how do i select the current cell im in .. in vba
lets say, im in B3 and edit the value - im working on a code that will say:
- in Row 3, check and recalculate D3 if necessary(which uses VBA to create a
validated list based on a loop... so i can't just use formulas)
if in row 4, check and recalculate D4.

so.. i need to be able to get the number of the row im in.. so i can set it
to a variable and go from there

any help?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 133
Default VBA syntax

thanks Jacob
im not quite sure what it all means.. can you explain what is happening with
msgbox, and the other .Column, .Address lines?
... so i can know how to edit it later


"Jacob Skaria" wrote:

Msgbox Activecell.Row
Activecell.Column
Activecell.Address

If this post helps click Yes
---------------
Jacob Skaria


"Derrick" wrote:

how do i select the current cell im in .. in vba
lets say, im in B3 and edit the value - im working on a code that will say:
- in Row 3, check and recalculate D3 if necessary(which uses VBA to create a
validated list based on a loop... so i can't just use formulas)
if in row 4, check and recalculate D4.

so.. i need to be able to get the number of the row im in.. so i can set it
to a variable and go from there

any help?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default VBA syntax

Activecell
refers to the current cell in VBA.

ActiveCell.Address
returns the current cell address

ActiveCell.Row
returns the current row and similarly column..

If this post helps click Yes
---------------
Jacob Skaria


"Derrick" wrote:

thanks Jacob
im not quite sure what it all means.. can you explain what is happening with
msgbox, and the other .Column, .Address lines?
.. so i can know how to edit it later


"Jacob Skaria" wrote:

Msgbox Activecell.Row
Activecell.Column
Activecell.Address

If this post helps click Yes
---------------
Jacob Skaria


"Derrick" wrote:

how do i select the current cell im in .. in vba
lets say, im in B3 and edit the value - im working on a code that will say:
- in Row 3, check and recalculate D3 if necessary(which uses VBA to create a
validated list based on a loop... so i can't just use formulas)
if in row 4, check and recalculate D4.

so.. i need to be able to get the number of the row im in.. so i can set it
to a variable and go from there

any help?

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 133
Default VBA syntax

hi again. i've figured it out mostly... but now im wondering if i can not
use the active cell.. but the cell i've just edited... because if i press
enter, it gives me the active cell row below the cell i just edited
is this possible?

"Jacob Skaria" wrote:

Msgbox Activecell.Row
Activecell.Column
Activecell.Address

If this post helps click Yes
---------------
Jacob Skaria


"Derrick" wrote:

how do i select the current cell im in .. in vba
lets say, im in B3 and edit the value - im working on a code that will say:
- in Row 3, check and recalculate D3 if necessary(which uses VBA to create a
validated list based on a loop... so i can't just use formulas)
if in row 4, check and recalculate D4.

so.. i need to be able to get the number of the row im in.. so i can set it
to a variable and go from there

any help?



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 133
Default VBA syntax

hi again. thanks for the explanation! now im wondering if i can:
not use the active cell.. but the cell i've just edited...
because if i press enter, it gives me the active cell row below the cell i
just edited
if i press tab im still ok. but i dont wanna have that possibility
is this achievable?

"Jacob Skaria" wrote:

Activecell
refers to the current cell in VBA.

ActiveCell.Address
returns the current cell address

ActiveCell.Row
returns the current row and similarly column..

If this post helps click Yes
---------------
Jacob Skaria


"Derrick" wrote:

thanks Jacob
im not quite sure what it all means.. can you explain what is happening with
msgbox, and the other .Column, .Address lines?
.. so i can know how to edit it later


"Jacob Skaria" wrote:

Msgbox Activecell.Row
Activecell.Column
Activecell.Address

If this post helps click Yes
---------------
Jacob Skaria


"Derrick" wrote:

how do i select the current cell im in .. in vba
lets say, im in B3 and edit the value - im working on a code that will say:
- in Row 3, check and recalculate D3 if necessary(which uses VBA to create a
validated list based on a loop... so i can't just use formulas)
if in row 4, check and recalculate D4.

so.. i need to be able to get the number of the row im in.. so i can set it
to a variable and go from there

any help?

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default VBA syntax

Right click the sheet tab View code and paste the below code

Private Sub Worksheet_Change(ByVal Target As Range)
MsgBox Target.Address & vbCrLf & Target.Row
End Sub

The worksheet change event will be fired as soon as you change a field
value.. Target refers to the cell you are in. Target.Row refers to the row
and similarly column..Target.Value refers to the value you have typed in

If this post helps click Yes
---------------
Jacob Skaria


"Derrick" wrote:

hi again. thanks for the explanation! now im wondering if i can:
not use the active cell.. but the cell i've just edited...
because if i press enter, it gives me the active cell row below the cell i
just edited
if i press tab im still ok. but i dont wanna have that possibility
is this achievable?

"Jacob Skaria" wrote:

Activecell
refers to the current cell in VBA.

ActiveCell.Address
returns the current cell address

ActiveCell.Row
returns the current row and similarly column..

If this post helps click Yes
---------------
Jacob Skaria


"Derrick" wrote:

thanks Jacob
im not quite sure what it all means.. can you explain what is happening with
msgbox, and the other .Column, .Address lines?
.. so i can know how to edit it later


"Jacob Skaria" wrote:

Msgbox Activecell.Row
Activecell.Column
Activecell.Address

If this post helps click Yes
---------------
Jacob Skaria


"Derrick" wrote:

how do i select the current cell im in .. in vba
lets say, im in B3 and edit the value - im working on a code that will say:
- in Row 3, check and recalculate D3 if necessary(which uses VBA to create a
validated list based on a loop... so i can't just use formulas)
if in row 4, check and recalculate D4.

so.. i need to be able to get the number of the row im in.. so i can set it
to a variable and go from there

any help?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
vba syntax Derrick Excel Discussion (Misc queries) 11 August 5th 09 08:37 PM
VB Syntax dhstein Excel Discussion (Misc queries) 6 November 8th 08 09:13 PM
IRR Syntax Bruce Excel Worksheet Functions 1 July 13th 07 09:02 PM
Help with Syntax Steve Excel Discussion (Misc queries) 2 June 21st 07 06:52 PM
If then syntax RL Excel Worksheet Functions 3 June 22nd 05 05:30 AM


All times are GMT +1. The time now is 04:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"