My problem is probably very simple...I'm about to pull my hair out! I am using Excel2007.
I want to use the value that is in one cell to determine which of two cells to select in the worksheet. No copy, delete, just SELECT.
When I hover over the code it has the correct value, but the code doesnt work.
The bad code follows. I left the comments in so you can see what I've tried. nothing works.
THANK YOU in advance for any help. I have never posted before in my life, I have always found answers on this forum.
Sub FigFedWHcht()
'select the correct chart (Married or Single)
Sheets("Chart").Select '.Range("P6").Select
Dim rng As Range
'Set MCht = Sheet2.Range("B11")
'Set SCht = Sheet2.Range("R11")
Set rng = Sheet2.Range("P6")
With rng
'rng = rng.Value
Select Case rng
Case M
'MCht.Select
'Sheet2.Range("B11").Select
Sheet2.Range("FirstCellMarriedChrt").Select
Case S
'SCht.Select
'Sheet2.Range("R11").Select
Sheet2.Range("FirstCellSingleChrt").Select
'Case Else
' MsgBox ("There seems to be a problem") 'FOR TESTING
' GoTo xit
End Select
End With
Call FedFindResult
xit:
End Sub
I want to use the value that is in one cell to determine which of two cells to select in the worksheet. No copy, delete, just SELECT.
When I hover over the code it has the correct value, but the code doesnt work.
The bad code follows. I left the comments in so you can see what I've tried. nothing works.
THANK YOU in advance for any help. I have never posted before in my life, I have always found answers on this forum.
Sub FigFedWHcht()
'select the correct chart (Married or Single)
Sheets("Chart").Select '.Range("P6").Select
Dim rng As Range
'Set MCht = Sheet2.Range("B11")
'Set SCht = Sheet2.Range("R11")
Set rng = Sheet2.Range("P6")
With rng
'rng = rng.Value
Select Case rng
Case M
'MCht.Select
'Sheet2.Range("B11").Select
Sheet2.Range("FirstCellMarriedChrt").Select
Case S
'SCht.Select
'Sheet2.Range("R11").Select
Sheet2.Range("FirstCellSingleChrt").Select
'Case Else
' MsgBox ("There seems to be a problem") 'FOR TESTING
' GoTo xit
End Select
End With
Call FedFindResult
xit:
End Sub