Compile Error

NYEXCEL1

Board Regular
Joined
Apr 17, 2013
Messages
123
Per the below macro, i am getting a compile error for the line in red. In short i want to see if any row in column D if there is a Number 5080 than print the word NOTHING otherwise the word NONEED, than goto the next row.

can someone let me know where the error maybe?

thanks


Sub Nyexcel3()
With Range("I4", Range("B" & Rows.Count).End(xlUp).Offset(, 7))
.Value = Evaluate(Replace("if((@ ="" ""),""NONEED"",if((@ =""""),"""",2010))", "@", .Offset(, -7).Address))
End With
With Range("I4", Range("D" & Rows.Count).End(xlUp).Offset(, 5))
.Value = Evaluate(Replace("if((@ =""5080""),""NOTHING"",""NONEED"", .Offset(, -5).Address))
End With




End Sub
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Try
Code:
.Value = Evaluate(Replace("if(@ =""5080"",""NOTHING"",""NONEED"")", "@", .Offset(, -5).Address))
 
Upvote 0
In the below Macro, specifically the section in red, i am trying to and an AND formula but do not know how.

In short, when the value is evaluated and it matches the "" "" format as shown, i need add a condition that say if the number in the cell with the offset of -5 of the row is 5080 then print word "NOTHING" otherwise "NONEED".

I thought maybe eliminating the first if statement (in red) and adding separate if statement just for this double condition would be easier but it didnt work. Really appreciate any help in getting this to work. Many thanks!!


Any help here would be great and if i am overthinking this


Sub Nyexcel2()
With Range("I4", Range("B" & Rows.Count).End(xlUp).Offset(, 7))
.Value = Evaluate(Replace("if((@ ="" ""),""NONEED"",if((@ =""""),"""",2010))", "@", .Offset(, -7).Address))
End With
End Sub
 
Upvote 0
Is the 5080 text or is it a number?
 
Upvote 0
In that case try
Code:
Sub Nyexcel3()
   With Range("I4", Range("B" & Rows.Count).End(xlUp).Offset(, 7))
      .Value = Evaluate(Replace(Replace("if((@ ="" "")*(@d=5080),""NOTHING"",if(@="" "",""NONEED"",if((@ =""""),"""",2010)))", "@d", .Offset(, -5).Address), "@", .Offset(, -7).Address))
   End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,180
Members
453,021
Latest member
Justyna P

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