Compile Error

NYEXCEL1

Board Regular
Joined
Apr 17, 2013
Messages
115
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
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,332
Office Version
365
Platform
Windows
Try
Code:
.Value = Evaluate(Replace("if(@ =""5080"",""NOTHING"",""NONEED"")", "@", .Offset(, -5).Address))
 

NYEXCEL1

Board Regular
Joined
Apr 17, 2013
Messages
115
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
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,332
Office Version
365
Platform
Windows
Is the 5080 text or is it a number?
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,332
Office Version
365
Platform
Windows
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
 

Forum statistics

Threads
1,082,367
Messages
5,365,028
Members
400,819
Latest member
Gossow

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top