Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 199
Default Help with an Excel macro

Can anyone please help me with some code for a macro that will achieve the
following in an Excel spreadsheet:


1. Go to 'Clients' worksheet if currently on another worksheet

2. Then go to a cell which is the cross point of Column W and the Row
defined by the number in cell A100


Many thanks,


V

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 793
Default Help with an Excel macro

Try
Sub macro()
Set ws = ThisWorkbook.Worksheets("Clients")
ws.Activate
rng = "W" & ws.Range("A100")
ws.Range(rng).Select
End Sub

"Victor Delta" wrote:

Can anyone please help me with some code for a macro that will achieve the
following in an Excel spreadsheet:


1. Go to 'Clients' worksheet if currently on another worksheet

2. Then go to a cell which is the cross point of Column W and the Row
defined by the number in cell A100


Many thanks,


V


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 199
Default Help with an Excel macro

"Sheeloo" wrote in message
...
Try
Sub macro()
Set ws = ThisWorkbook.Worksheets("Clients")
ws.Activate
rng = "W" & ws.Range("A100")
ws.Range(rng).Select
End Sub


Many thanks,

V

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 199
Default Help with an Excel macro

"Victor Delta" wrote in message
...
"Sheeloo" wrote in message
...
Try
Sub macro()
Set ws = ThisWorkbook.Worksheets("Clients")
ws.Activate
rng = "W" & ws.Range("A100")
ws.Range(rng).Select
End Sub


This worked fine until I inserted some additional rows into the spreadsheet
the other day and therefore needed the range formula reference to change to
A105 rather than A100.

Is there a way to improve the formula so this happens automatically in
future?

TIA

V

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Help with an Excel macro

Select the cell that contains that important information.
Then give it a nice name by typing something like this in the name box (to the
left of the formula bar):
myRowNumber
(remember to hit enter when finish your typing!)

Then change the code to something like:

rng = "W" & ws.Range(myRowNumber).Value
(I like to qualify the property!)



Victor Delta wrote:

"Victor Delta" wrote in message
...
"Sheeloo" wrote in message
...
Try
Sub macro()
Set ws = ThisWorkbook.Worksheets("Clients")
ws.Activate
rng = "W" & ws.Range("A100")
ws.Range(rng).Select
End Sub


This worked fine until I inserted some additional rows into the spreadsheet
the other day and therefore needed the range formula reference to change to
A105 rather than A100.

Is there a way to improve the formula so this happens automatically in
future?

TIA

V


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 199
Default Help with an Excel macro

"Dave Peterson" wrote in message
...
Select the cell that contains that important information.
Then give it a nice name by typing something like this in the name box (to
the
left of the formula bar):
myRowNumber
(remember to hit enter when finish your typing!)

Then change the code to something like:

rng = "W" & ws.Range(myRowNumber).Value
(I like to qualify the property!)


Brilliant! Many thanks,

V

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 199
Default Help with an Excel macro

"Victor Delta" wrote in message
...
"Dave Peterson" wrote in message
...
Select the cell that contains that important information.
Then give it a nice name by typing something like this in the name box
(to the
left of the formula bar):
myRowNumber
(remember to hit enter when finish your typing!)

Then change the code to something like:

rng = "W" & ws.Range(myRowNumber).Value
(I like to qualify the property!)


Brilliant! Many thanks,

V


Actually, didn't work until I discovered by trial and error that the
inverted commas had to be put back!

Final code therefo rng = "W" & ws.Range("myRowNumber").Value

V

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
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 08:22 PM
passing arguments from an excel macro to a word macro KWE39 Excel Discussion (Misc queries) 1 July 7th 05 03:56 PM


All times are GMT +1. The time now is 10:32 PM.

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"