Excel 2013
Win 7 pro
I have a macro, that based on information input on "sheet 1" copies calculations from 1 of 3 areas on "sheet 2" or "sheet 3" which are hidden and pastes them on "sheet 1"
When running the macro from the shortcut key there are no problems.
If the macro is run from a button (form control) placed on "sheet 1" it does not work unless "sheet 2 or 3" is unhidden.
Any idea why it works for the shortcut key but not the button?
Thanks.
Win 7 pro
I have a macro, that based on information input on "sheet 1" copies calculations from 1 of 3 areas on "sheet 2" or "sheet 3" which are hidden and pastes them on "sheet 1"
When running the macro from the shortcut key there are no problems.
If the macro is run from a button (form control) placed on "sheet 1" it does not work unless "sheet 2 or 3" is unhidden.
Any idea why it works for the shortcut key but not the button?
Thanks.
Code:
Sub Get_Results()
'
' Get_Results Macro
'
' Keyboard Shortcut: Ctrl+g
'
'
Dim county As String
Dim condition As Integer
'
Application.ScreenUpdating = False
Sheets("ESD Requirement1A (CITY)").Visible = True
Sheets("ESD Requirement1A").Visible = True
Range("c8:f8").Select
county = ActiveCell.Value
'
Range("a41").Select
condition = ActiveCell.Value
'
Range("a65:k95").Select
Selection.ClearContents
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
'
If county = "Baltimore City" Then
Sheets("ESD Requirement1A (CITY)").Select
Else
Sheets("ESD Requirement1A").Select
End If
'
If condition = 1 Then
Range("A1:K13").Copy Sheets("ESD Sizing1A").Range("a65")
End If
'
If condition = 2 Then
Range("A16:K41").Copy Sheets("ESD Sizing1A").Range("a65")
End If
'
If condition = 3 Then
Range("A46:K73").Copy Sheets("ESD Sizing1A").Range("a65")
End If
'
'
Sheets("ESD Requirement1A").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("ESD Requirement1A (CITY)").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("ESD Sizing1A").Select
Application.ScreenUpdating = True
Range("a65").Select
'
End Sub