Re: Executing Macro Help

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



welcome

--


Gary


<alexdetrano@xxxxxxxxx> wrote in message
news:1177999224.668010.20810@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On May 1, 1:52 am, "Gary Keramidas" <GKeramidasATmsn.com> wrote:
unless i'm missing something, i'm guessing this code always modifies the same
***, rev?

so try this:

Sub base()
'
' base Macro
' Macro recorded 4/16/2007 by User
'

With Worksheets("rev")
.Range("B83").Value = "415"
.Range("B84").Value = "235"
.Range("B85").Value = "50"
.Range("B86").Value = "25"
.Range("B87").Value = "75"
.Range("B88").Value = "70"
.Range("B89").Value = "98"
.Range("B90").Value = "126"
.Range("A90").Value = "Occupancy-90% -3RD "
.Range("A89").Value = "Occupancy-70% -2ND"
.Range("A88").Value = "Occupancy-50% -1ST 4 MO."
End With
End Sub

--

Gary

<alexdetr...@xxxxxxxxx> wrote in message

news:1177996780.452582.73680@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

yes, that is correct. I have the combo box always present, so that
even if I change tabs, I have the option of choosing a scenario.
Currently, when I pick a scenario, the macro is executed on the
current work***. This is no good, as it overwrites things that are
there. So I need the macro to change only the cells in the rev
work***. I'm thinking I need to change the lines inside the macro
to have the rev title in front of the cell, but I'm not sure how to do
this. Here's my code for the rev page

Private Sub ComboBox1_Change()
Select Case Me.ComboBox1.Value
Case "basic": Call base
Case "increased": Call Increased
Case "decreased": Call Reduced
Case "superior": Call Superior
Case "inferior": Call Inferior
End Select
End Sub

Private Sub Worksheet_Activate()
cboScenario.Show vbModeless
End Sub

-----------------

here is my code for the macro called basic (which is an option in the
combo box)

Sub base()
'
' base Macro
' Macro recorded 4/16/2007 by User
'

'
Range("B83").Select
ActiveCell.FormulaR1C1 = "415"
Range("B84").Select
ActiveCell.FormulaR1C1 = "235"
Range("B85").Select
ActiveCell.FormulaR1C1 = "50"
Range("B86").Select
ActiveCell.FormulaR1C1 = "25"
Range("B87").Select
ActiveCell.FormulaR1C1 = "75"
Range("B88").Select
ActiveCell.FormulaR1C1 = "70"
Range("B89").Select
ActiveCell.FormulaR1C1 = "98"
Range("B90").Select
ActiveCell.FormulaR1C1 = "126"
Range("A90").Select
ActiveCell.FormulaR1C1 = "Occupancy-90% -3RD "
Range("A89").Select
ActiveCell.FormulaR1C1 = "Occupancy-70% -2ND"
Range("A88").Select
ActiveCell.FormulaR1C1 = "Occupancy-50% -1ST 4 MO."

End Sub

Thank you so much! This is EXACTLY what I needed! I can't thank you
enough!



.


Quantcast