Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default Cell and Worksheet Location

I need to establish (programatically find) the activeworksheet and active or
selected cell at the start of a macro I need to write. I need to validate
that the user of the macro is in the right sheet and column and row range
before I run the rest of the macro code.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 192
Default Cell and Worksheet Location

This should do the trick:

Option Explicit
Sub Right_Location()

Dim sheetname As String
sheetname = ActiveSheet.Name

If vbNo = MsgBox(sheetname & " " & ActiveCell.Address & ": Is this the
correct starting location?", vbYesNo) Then
MsgBox ("Please select the correct starting location.")
End
End If

End Sub



"Glenn" wrote:

I need to establish (programatically find) the activeworksheet and active or
selected cell at the start of a macro I need to write. I need to validate
that the user of the macro is in the right sheet and column and row range
before I run the rest of the macro code.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Cell and Worksheet Location

Suppose you want "Sheet1" and cell A5 to be the active ones.

If ActiveSheet.Name < "Sheet1" Or _
ActiveCell.Address < "$A$5" Then
MsgBox "Blah blah" 'optional
Exit Sub
End If

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default Cell and Worksheet Location

Thanks very much. I believe I'm good to go.

"StumpedAgain" wrote:

This should do the trick:

Option Explicit
Sub Right_Location()

Dim sheetname As String
sheetname = ActiveSheet.Name

If vbNo = MsgBox(sheetname & " " & ActiveCell.Address & ": Is this the
correct starting location?", vbYesNo) Then
MsgBox ("Please select the correct starting location.")
End
End If

End Sub



"Glenn" wrote:

I need to establish (programatically find) the activeworksheet and active or
selected cell at the start of a macro I need to write. I need to validate
that the user of the macro is in the right sheet and column and row range
before I run the rest of the macro code.

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
Get location of match in another worksheet AZSteve Excel Worksheet Functions 0 March 15th 10 05:01 PM
Reference Worksheet Location from web rKeen Links and Linking in Excel 0 October 22nd 09 12:21 AM
Row to Be shifted to another location in the same Worksheet Misho Excel Discussion (Misc queries) 0 May 21st 09 05:11 PM
Move active cell to same location on each worksheet BeanoKid Excel Discussion (Misc queries) 3 April 15th 08 11:29 PM
How do I freeze more than one location on my worksheet? Melody Excel Worksheet Functions 3 January 29th 06 07:41 AM


All times are GMT +1. The time now is 05:45 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"