If - Then - Else to read a certain cell

charlie727

New Member
Joined
Aug 3, 2014
Messages
12
Hi,

I have a small query regarding if then Else. I need VBA to read a certain cell and depending on the value run through two different lines of code. I'm having problems getting VBA to read the underlined code. My code below is

Sheets("Sheet2").Select
myFileName = ActiveSheet.Range("a11").Value

ActiveSheet.Range("B33").Activate
If ActiveCell.Value = "DAMS" Or "DAWS" Then

Workbooks.Open Filename:="H:\FINANCIAL SERVICES\Structured Products\Termsheets\FX Accumulator\TS & Notice - Forex Accumulator GTEE LEV_3 DAMSDAWS.xls"
Sheets("TS").Select
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False


Else
Workbooks.Open Filename:="H:\FINANCIAL SERVICES\Structured Products\Termsheets\FX Accumulator\TS & Notice - Forex Accumulator GTEE LEV_3 WAMSWAWS.xls"
Sheets("TS").Select
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

End If

Any help would be much appreciated

Thank you
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
change that line to read

Rich (BB code):
If ActiveCell.Value = "DAMS" Or ActiveCell.Value = "DAWS" Then

and it would be quicker if it was
Rich (BB code):
ActiveSheet.Range("B33").Activate....delete this line
If range("B33").Value = "DAMS" Or range("B33").Value = "DAWS" Then
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,647
Messages
6,173,538
Members
452,520
Latest member
Pingaware

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