LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Running a macro in a predetermine range if not them msgBox

I have CommandButton that when you click on it, it triggers a Form with a
List and when you click on an value then it pastes the value from the list
into the selected cell (B5). Also it will check for the value in cell E1 in
the sheet named "formula" and then it will Offset 3 cell(E5). Here is the
problem, I want for the macro only to execute in the range on B5:B159 and if
not in range B5:B159 then a message would say something like "Select a Cell
in Column B".
I have columns D and F with formulas and if anyone chooses an unlocked
(column C, D or E) the 3dr cell changes even if it is locked. Here is a piece
of code of what I have at the moment. I really appreciate your response,
Thanks


Private Sub CommandButton1_Click()
If lstSelection.ListIndex = -1 Then
MsgBox "No item selected", vbExclamation
Exit Sub
End If
Range("SelectionLink") = lstSelection.ListIndex + 1
Selection.Cells(1) = Worksheets("Formulas").Range("D1")
Selection.Cells(1).Offset(0, 3) = Worksheets("Formulas").Range("E1")
Unload Me
End Sub

Private Sub CommandButton2_Click()
Unload Me
End Sub

Private Sub lstSelection_Click()

End Sub

Private Sub UserForm_Click()

End Sub

KBREnner
 
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
Create macro to calculate data range for a running chart James Lucero Excel Worksheet Functions 1 April 29th 08 04:27 PM
Running a macro if any data is entered in a range of cells Jonathan Excel Worksheet Functions 3 November 16th 05 08:38 PM
Eliminating Excel msgbox from popping up while macro is running. dpdutke Excel Programming 2 November 23rd 03 07:55 PM
Running a macro if msgbox is yes Todd Huttenstine[_2_] Excel Programming 2 November 16th 03 11:07 PM
Predetermine Worksheet to Start In mickeyblake Excel Programming 4 August 10th 03 11:40 AM


All times are GMT +1. The time now is 12:17 PM.

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"