I'm trying to run a macro based on whether a cell value is "1", "2", etc. I have a set of ComboBoxes and a Command Button. Once the Command Button is clicked, a set of data will be graphed based on what the ComboBoxes select.
I'm not sure if I have my if/then statements right. Specifically, what I want the code to do is, for example, if cell D5 is "1" and cell "G5" is "1", a set of data will be graphed. So there are 2 if/then statements.
D5 can be a number 1-6, and G5 can be a number 1-2.
The graph is automatically set up; it just needs the values to be pasted in its specific range. However, nothing ever gets pasted, so the graph doesn't generate. Any help? Thanks!
Here's what I have below..
I'm not sure if I have my if/then statements right. Specifically, what I want the code to do is, for example, if cell D5 is "1" and cell "G5" is "1", a set of data will be graphed. So there are 2 if/then statements.
D5 can be a number 1-6, and G5 can be a number 1-2.
The graph is automatically set up; it just needs the values to be pasted in its specific range. However, nothing ever gets pasted, so the graph doesn't generate. Any help? Thanks!
Here's what I have below..
Code:
If (D5 = "1") Then
If (G5 = "1") Then
Sheets("Graph Data").Select
ActiveWindow.SmallScroll Down:=-15
Range("A2:H200").Select
Selection.ClearContents
Range("J4").Select
Sheets("Raw Data").Select
Range("A11:D73").Select
Selection.Copy
Sheets("Graph Data").Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("L33").Select
ElseIf (G5 = "2") Then
Sheets("Graph Data").Select
ActiveWindow.SmallScroll Down:=-15
Range("A2:H200").Select
Selection.ClearContents
Range("J4").Select
Sheets("Raw Data").Select
Range("E11:H71").Select
Selection.Copy
Sheets("Graph Data").Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("L33").Select
End If