sheet code question and cmd button question

A1058

New Member
Joined
Sep 13, 2006
Messages
46
guys hoping someone can help out...
ive got some sheet code that changes the interior colors of some cells. which works just fine but doesnt run until the user enters any value into the sheet. how can i make it work witout having to have entered anything. maybe when the sheet becomes active??? also one more question i have a command button that executes a list of things when clicked how can i make it ask the user "Are you sure" yes or no ???

any help is appreciated
thank you
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Can you post your code?

For the second part you can use something like:

<font face=Tahoma><SPAN style="color:#00007F">Sub</SPAN> DoMe()
    <SPAN style="color:#00007F">Dim</SPAN> Response <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>
    
    Response = MsgBox("Do you want to proceed?", vbQuestion + vbYesNoCancel, "Proceed?")
    <SPAN style="color:#00007F">Select</SPAN> <SPAN style="color:#00007F">Case</SPAN> Response
        <SPAN style="color:#00007F">Case</SPAN> vbYes
            MsgBox "Proceeding"
        <SPAN style="color:#00007F">Case</SPAN> vbNo
            MsgBox "Exiting"
    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Select</SPAN>
    
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>

HTH,

Smitty
 
Upvote 0
thank you smitty i had just figure out the yes/no msgbox. mine wasnt as pretty looking as yours but functional. ill use yours i like the additional proceeding message.. ill post ya a small section of the code in each sheet that doesnt do anything until the user enters some value in the sheet.

Code:
'======================
Dim Sh As Worksheet

With Sh
  If [a42].Value <= 0 Then
      [h12:h14].Interior.ColorIndex = 0
    ElseIf [a42].Value > 0 And [a42].Value <= 1 Then
      [h12].Interior.ColorIndex = 6
    ElseIf [a42].Value > 1 And [a42].Value <= 2 Then
      [h12:h13].Interior.ColorIndex = 6
    ElseIf [a42].Value > 2 And [a42].Value <= 3 Then
      [h12:h14].Interior.ColorIndex = 6
    Else
  End If
End With
'========================

would be nice if this would happen as soon as the sheet is activated(there are 15 sheets in my workbook they are all identical..

EDIT: Added Code tags - Smitty
 
Upvote 0
would be nice if this would happen as soon as the sheet is activated

There is a global sheet activate event:

Code:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)

Just put your code there and it'll run on every sheet.

Smitty
 
Upvote 0
awesome smitty. thanks a million.. im going to make those changes right now see how it comes out..
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,215
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top