graemeal
Active Member
- Joined
- May 17, 2007
- Messages
- 316
- Platform
- Windows
The first code is my original that works fine. Activated by CTL F
I want to remove one of the ranges and change the other one within the code EG
When I try to activate the bottom code by CTL F I get a Subscript out of range error
Thanks
From this
To
To This
I want to remove one of the ranges and change the other one within the code EG
When I try to activate the bottom code by CTL F I get a Subscript out of range error
Thanks
From this
Code:
Range("J2:J1839").Formula = "=IF(AND(G2,D2>1000,C2>1000),D2/C2,0)"
Range("L2:L1839").Formula = "=IF(AND(G2,D2>1000,C2>1000),Y2/Z2,0)"
To
Code:
Range("J2:J1839").Formula = "=IF(AND(G2=0,J2>1.1,L2>1.2,D2>1000,C2>1000),J2+L2/2,0)"
Code:
Sub Macro5()
Windows("1876.xlsm").Activate
Sheets("Sheet1").Select
Range("J2:J1839").Formula = "=IF(AND(G2,D2>1000,C2>1000),D2/C2,0)"
Range("L2:L1839").Formula = "=IF(AND(G2,D2>1000,C2>1000),Y2/Z2,0)"
Range("A2").Select
ActiveCell.FormulaR1C1 = "0"
Range("A2").Select
Selection.AutoFill Destination:=Range("A2:A1839")
Range("A2:A1839").Select
Range("A2").Select
End Sub
To This
Code:
Sub Macro5()
Windows("1876.xlsm").Activate
Sheets("Sheet1").Select
Range("J2:J1839").Formula = "=IF(AND(G2=0,J2>1.1,L2>1.2,D2>1000,C2>1000),J2+L2/2,0)"
Range("A2").Select
ActiveCell.FormulaR1C1 = "0"
Range("A2").Select
Selection.AutoFill Destination:=Range("A2:A1839")
Range("A2:A1839").Select
Range("A2").Select
End Sub