What is wrong with my code?

Finance20

New Member
Joined
Aug 19, 2011
Messages
8
Sub Multiplier()
'
'Muttiplier Number Format by MEI given FYE & Clinic Type
'
'
Workbooks("RL-Facility Charge Lookup 1-7-2011 2010.xls").Activate
Worksheets("Facility Lookup").Activate
Range("F11:F14").Activate
If Range(A6) = "RHCP" Or "RHCI" And Range(B4) = "2005" Then
Range("F11:F14").Value = (1.029 * 0.25) + (1.031 * 0.75)


End If
End Sub

I am getting error in debugger on Lines beginning with: If Range
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Then

Code:
If (Range("A6").Value = "RHCP" Or Range("A6").Value = "RHCI") And Range("B4").Value = "2005" Then
    Range("F11:F14").Value = 1.0305
End If
 
Upvote 0
Nevermind I got it! The RHCP etc was referencing the wrong cell, needed to be B6 instead of A6. Stupid mistake of mines. Thanks!
 
Upvote 0
I'm not aware of a limit but there must be one. You might be better off with a Select Case statement.
 
Upvote 0
Right click the sheet tab, select View Code and paste in

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "B4" Then
    Application.EnableEvents = False
    Call Multiplier
    Application.EnableEvents = True
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,225,156
Messages
6,183,246
Members
453,152
Latest member
ChrisMd

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