View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default selecting a specific cell within a selected range

Brian,

I guess you would have a textbox to get the task name (though I would use a Listbox for each of
these to allow selecting the value from a predefined list):

Something like this should work:

Set rng = Intersect(Worksheets("Employee Tracker").Range( _
.TextboxFirst.Text & "_" & .TextBoxLast.Text), _
Worksheets("Employee Tracker").Range( _
.TextboxTask.Text))

Of course, error checking and all that would be required - one advantage of using listboxes....

HTH,
Bernie
MS Excel MVP


"BrianMo" wrote in message
...
I see what you are saying with that Bernie there is just one problem the name
of the range such as Brian Monaghan will be dependent apon what the user
enters into the message box on the user form. So I would not be able to
enter in what the first range name as an absolute it needs to be the current
selection on the sheet since the following code selects that specific range
of the users name. For example this is the code I have to determine the range
selction for the user.

Private Sub Login_click()
With UserInterface
On Error Resume Next
Set rng = Worksheets("Employee Tracker").Range( _
.TextboxFirst.Text & "_" & .TextBoxLast.Text)
If rng Is Nothing Then
MsgBox "Bad name, quitting"
Unload UserInterface
ThisWorkbook.Close Savechanges:=False
End If
End With
Worksheets("Employee Tracker").Unprotect Password:="testpass"
Range("A5:N25").Select
Selection.Locked = True
Application.Goto rng, True
Unload UserInterface
Call Macro3
End Sub



"Bernie Deitrick" wrote:

Brian,

Perhaps along these lines - if the named ranges are on the same page...

Dim myCell As Range
Set myCell = Intersect(Range("Brian_Monaghan"), Range("Analytical"))

Or, if you are using variables:
Set myCell = Intersect(Range(VarName), Range(VarTask))

HTH,
Bernie
MS Excel MVP


"BrianMo" wrote in message
...
I am trying to use a macro for an option button on my spreadsheet to have it
go to a specific cell within the currently selected range. On my worksheet
currently I have a user form which with the use of a code that goes directly
to the range of cells based apon the name that the user inputs. For example
if the name Brian Monaghan is entered on my user form the range
Brian_Monaghan is then selected on my spreadsheet titlted Employee Tracker.
Then after that selection is made I want the user to be able to go over to a
definition page where the various tasks are defined with option buttons for
them to click. For example if the user determines they have performed an
analytical they would click the analytics button and then be taken to that
cell within their specific range. The tasks are all grouped by their
corresponding range names.