Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
scott_ross_3
 
Posts: n/a
Default Cell reference based on calculation

In my worksheet I have a calculation (count of records). I want the macro to
send by cursor / cell reference that many rows down in the spreadsheet.
However, I want to do this in a blank row, so "Selection.End(xlDown).Select"
doesnt work. Can someone help be simply move my cursor to that location?
(Yes, I'm an amateur).

Example:
I have data in A2 through B50
Cell A1 = count(A2:b50)...this calculates 98.
I want the cell reference to move to C98.

I'm beyond ignorant, and don't know how to program that into my macro. Any
help would be appreciated. Thanks.
  #2   Report Post  
Dave O
 
Posts: n/a
Default

When you say I want the cell reference to move to C98<< do you mean
you want the cell *pointer* to move? If so, then this line will move
the pointer to that cell:

Range("c" & Range("a1").Value).Select

  #3   Report Post  
PeterAtherton
 
Posts: n/a
Default

Assuming that the column might change in the future, the following is a
flexible way of finding a cell

Sub test()
Dim r As Long, nr As Long, row As Long
Dim col As Integer, nxtcol As Integer
row = Range("A1")
col = Range("a1").CurrentRegion.Columns.Count
nxtcol = col + 1
Cells(row, nxtcol).Select
End Sub

you could also use row=RAnge("a1").currentregion.rows.count

regards
Peter

"scott_ross_3" wrote:

In my worksheet I have a calculation (count of records). I want the macro to
send by cursor / cell reference that many rows down in the spreadsheet.
However, I want to do this in a blank row, so "Selection.End(xlDown).Select"
doesnt work. Can someone help be simply move my cursor to that location?
(Yes, I'm an amateur).

Example:
I have data in A2 through B50
Cell A1 = count(A2:b50)...this calculates 98.
I want the cell reference to move to C98.

I'm beyond ignorant, and don't know how to program that into my macro. Any
help would be appreciated. Thanks.

  #4   Report Post  
topola
 
Posts: n/a
Default

Hi,
Try using the following macro:

Sub Macro1()
Dim Counter As Integer
Counter = Selection.Cells.Count
Cells(Counter, 3).Select
End Sub

You can open Visual Basic panel using Alt+F11 or ToolMacroVisual
Basic Editor. Then: InsertModule. Within a module just copy the
following instruction.

Regards,
Tomek Polak
www.vba.blog.onet.pl

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
indirect function to reference cell on different sheet Dolemite Excel Worksheet Functions 2 August 19th 05 05:25 PM
Cell Value Updated based cell input DC Excel Discussion (Misc queries) 2 August 17th 05 11:07 PM
Flexible Cell Reference Brandt Excel Discussion (Misc queries) 5 June 2nd 05 10:23 PM
Cell Formula reference to cell Based On third Cell Content Gabriel Excel Discussion (Misc queries) 1 February 11th 05 06:36 AM
Cell Reference Math Ralph Howarth Excel Worksheet Functions 0 January 26th 05 06:27 PM


All times are GMT +1. The time now is 11:23 PM.

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

About Us

"It's about Microsoft Excel"