Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 93
Default Range - using in code

Hi, All! Excel coding is a whole new ball game!
I set ranges (A5:F11) as "PeopleDrivers" and range (A13:F26) as
"ProcessDrivers".

Column F is a "Click here" column that is suppose to open a form based on
code, and I hope based on the row.

I want to say if the cursor is on column F within the row range (5 through
12), open RiskForm,
if the cursor is on column F within the row range (13 through 26), open
ProcessForm.... And so on.

I don't seem to understand ActiveCell, rows, columns, ranges.... And would
appreciate your guidance.

Cheers,
Stephanie
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,722
Default Range - using in code

You'll need to use event coding. Right-click on sheet tab, view code. This
one will activate upon cell selection.
'========
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("F5:F12")) Is Not Nothing Then
'What you want to happen under condition 1
Call Macro1
End If
If Intersect(Target, Range("F13:F26")) Is Not Nothing Then
'What you want to happen under condition 2
Call Macro2
End If
End Sub
'========

OR, if you want to make it so that user has to double click (can lead to
less annoyance) change title to:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)

--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Stephanie" wrote:

Hi, All! Excel coding is a whole new ball game!
I set ranges (A5:F11) as "PeopleDrivers" and range (A13:F26) as
"ProcessDrivers".

Column F is a "Click here" column that is suppose to open a form based on
code, and I hope based on the row.

I want to say if the cursor is on column F within the row range (5 through
12), open RiskForm,
if the cursor is on column F within the row range (13 through 26), open
ProcessForm.... And so on.

I don't seem to understand ActiveCell, rows, columns, ranges.... And would
appreciate your guidance.

Cheers,
Stephanie

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Range - using in code

Right click the Sheet tab and view code. Paste the below code and try...You
can remove the Msgboxs

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(ActiveCell, Range("F5:F12")) Is Nothing Then
MsgBox "Riskform"
Load UserForm1
UserForm1.Show
ElseIf Not Application.Intersect(ActiveCell, Range("F13:F26")) Is Nothing Then
MsgBox "Process form"
Load UserForm2
UserForm2.Show
End If
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Stephanie" wrote:

Hi, All! Excel coding is a whole new ball game!
I set ranges (A5:F11) as "PeopleDrivers" and range (A13:F26) as
"ProcessDrivers".

Column F is a "Click here" column that is suppose to open a form based on
code, and I hope based on the row.

I want to say if the cursor is on column F within the row range (5 through
12), open RiskForm,
if the cursor is on column F within the row range (13 through 26), open
ProcessForm.... And so on.

I don't seem to understand ActiveCell, rows, columns, ranges.... And would
appreciate your guidance.

Cheers,
Stephanie

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 93
Default Range - using in code

Not sure if this posted...

Thanks. I am trying to modify an exisiting module. Let me post it here and
perhaps the group can tell me where I've gone wrong.

**This works well**
Public Sub FormLaunch()
If ActiveSheet.Name = "Risk Criteria" Then
Else
If ActiveCell.Column = 6 And ActiveCell.Row 4 Then
If Cells(ActiveCell.Row, ActiveCell.Column - 4) = Range("mcdLanguage").Value
Then
RiskFormMCD.Show

**Into the Abyss!**
If Cells(ActiveCell.Row, ActiveCell.Column) = Range("PeopleDrivers").Value
Then
RiskForm.Show
Else
If Cells(ActiveCell.Row, ActiveCell.Column) = Range("ProcessDrivers").Value
Then
ProcessForm.Show

Thanks,
Stephanie
"Luke M" wrote:

You'll need to use event coding. Right-click on sheet tab, view code. This
one will activate upon cell selection.
'========
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("F5:F12")) Is Not Nothing Then
'What you want to happen under condition 1
Call Macro1
End If
If Intersect(Target, Range("F13:F26")) Is Not Nothing Then
'What you want to happen under condition 2
Call Macro2
End If
End Sub
'========

OR, if you want to make it so that user has to double click (can lead to
less annoyance) change title to:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)

--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Stephanie" wrote:

Hi, All! Excel coding is a whole new ball game!
I set ranges (A5:F11) as "PeopleDrivers" and range (A13:F26) as
"ProcessDrivers".

Column F is a "Click here" column that is suppose to open a form based on
code, and I hope based on the row.

I want to say if the cursor is on column F within the row range (5 through
12), open RiskForm,
if the cursor is on column F within the row range (13 through 26), open
ProcessForm.... And so on.

I don't seem to understand ActiveCell, rows, columns, ranges.... And would
appreciate your guidance.

Cheers,
Stephanie

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 93
Default Range - using in code

Thaks Jacob- I just posted a bit more information if you have time. Thanks!

"Jacob Skaria" wrote:

Right click the Sheet tab and view code. Paste the below code and try...You
can remove the Msgboxs

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(ActiveCell, Range("F5:F12")) Is Nothing Then
MsgBox "Riskform"
Load UserForm1
UserForm1.Show
ElseIf Not Application.Intersect(ActiveCell, Range("F13:F26")) Is Nothing Then
MsgBox "Process form"
Load UserForm2
UserForm2.Show
End If
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Stephanie" wrote:

Hi, All! Excel coding is a whole new ball game!
I set ranges (A5:F11) as "PeopleDrivers" and range (A13:F26) as
"ProcessDrivers".

Column F is a "Click here" column that is suppose to open a form based on
code, and I hope based on the row.

I want to say if the cursor is on column F within the row range (5 through
12), open RiskForm,
if the cursor is on column F within the row range (13 through 26), open
ProcessForm.... And so on.

I don't seem to understand ActiveCell, rows, columns, ranges.... And would
appreciate your guidance.

Cheers,
Stephanie



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 93
Default Range - using in code

Jacob,

I think that got me where I need to go. Thanks!

Cheers,
Stephanie

"Jacob Skaria" wrote:

Right click the Sheet tab and view code. Paste the below code and try...You
can remove the Msgboxs

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(ActiveCell, Range("F5:F12")) Is Nothing Then
MsgBox "Riskform"
Load UserForm1
UserForm1.Show
ElseIf Not Application.Intersect(ActiveCell, Range("F13:F26")) Is Nothing Then
MsgBox "Process form"
Load UserForm2
UserForm2.Show
End If
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Stephanie" wrote:

Hi, All! Excel coding is a whole new ball game!
I set ranges (A5:F11) as "PeopleDrivers" and range (A13:F26) as
"ProcessDrivers".

Column F is a "Click here" column that is suppose to open a form based on
code, and I hope based on the row.

I want to say if the cursor is on column F within the row range (5 through
12), open RiskForm,
if the cursor is on column F within the row range (13 through 26), open
ProcessForm.... And so on.

I don't seem to understand ActiveCell, rows, columns, ranges.... And would
appreciate your guidance.

Cheers,
Stephanie

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
Find a range using code Jonathan Brown Excel Worksheet Functions 3 October 1st 08 12:02 PM
CODE 4 MOVING WITHIN A RANGE-TAB FARAZ QURESHI Excel Discussion (Misc queries) 0 December 5th 07 10:23 AM
VBA CODE range mikespeck Excel Worksheet Functions 0 August 8th 06 05:24 PM
Looking for code to define a range Ant Excel Discussion (Misc queries) 3 October 3rd 05 06:22 PM
Code to select range Shawn Excel Discussion (Misc queries) 1 June 2nd 05 05:14 PM


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