Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Dynamic cell address resolution in visual basic application?

I am attempting to create an excel worksheet where when a user clicks on a
button (located in a cell), the worksheet will scroll to a pre-determined
location in the worksheet. My problem is that the only means I can find of
specifying the location to scroll is by supplying a static cell address. This
is problematic when a row is inserted in the spreadsheet, as I am attempting
to use this button; click; scroll convention in numerous places in the
spreadsheet, thus it creates a maintenance nightmare trying to keep all of
the addresses current.

Below is a sample of the VB code associated with the worksheet:
Private Sub CommandButton29_Click()
Application.Goto Reference:=Worksheets("Map").Range("A95"), Scroll:=True
End Sub

Any suggestions as to how I can modify this code so that the "A95" address
will dynamically be updated should a row be inserted in the worksheet that
would cause the actual location of the cell to move, would be greatly
appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Dynamic cell address resolution in visual basic application?

Name cell A95 something, like "AMapCell" and change your code to

Application.Goto Reference:=Worksheets("Map").Range("AMapCell"),

Then it won't matter....

HTH,
Bernie
MS Excel MVP


"John Carter" wrote in message
...
I am attempting to create an excel worksheet where when a user clicks on a
button (located in a cell), the worksheet will scroll to a pre-determined
location in the worksheet. My problem is that the only means I can find of
specifying the location to scroll is by supplying a static cell address. This
is problematic when a row is inserted in the spreadsheet, as I am attempting
to use this button; click; scroll convention in numerous places in the
spreadsheet, thus it creates a maintenance nightmare trying to keep all of
the addresses current.

Below is a sample of the VB code associated with the worksheet:
Private Sub CommandButton29_Click()
Application.Goto Reference:=Worksheets("Map").Range("A95"), Scroll:=True
End Sub

Any suggestions as to how I can modify this code so that the "A95" address
will dynamically be updated should a row be inserted in the worksheet that
would cause the actual location of the cell to move, would be greatly
appreciated.



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
Visual basic excel application WilliamMomo Excel Programming 2 November 23rd 05 02:25 PM
How do I protect Visual Basic for Application Code Zagrijs Venter New Users to Excel 6 August 5th 05 09:24 PM
VBE( Visual Basic Application) phil[_4_] Excel Programming 1 July 7th 05 03:27 AM
How do I open an application and run a file using visual basic Cozy Excel Programming 0 March 13th 05 09:49 AM
Visual Basic run-time error when printing from web application... GWS Excel Programming 0 February 23rd 05 04:09 PM


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

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"