formula or VBA

VbaHell

Well-known Member
Joined
Jan 30, 2011
Messages
1,220
Hello all

I am trying to figure out this Formula or I can use VBA as the formula will but put into VBA.

This is what I am trying to do

If V2 = Blank then ignore cell U2
If V2 >"" then U2 = "Lost"

This formula or VBA would be looped through 5,000 rows

Code:
=IF(ISBLANK(V2),"",U2="Lost")

I can't put the formula in U2 because there is data in there that needs to remain unless V2 had data in
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
How about
Code:
Sub VbaHell()
   With Range("U2", Range("V" & Rows.Count).End(xlUp).Offset(, -1))
      .Value = Evaluate(Replace("If(@=""""," & .Address & ",""Lost"")", "@", .Offset(, 1).Address))
   End With
End Sub
 
Upvote 0
This is what I am trying to do

If V2 = Blank then ignore cell U2
If V2 >"" then U2 = "Lost"
What is in the cells of Column V... formulas or constant values?

What type of values are in Column V... text or numbers?
 
Last edited:
Upvote 0
Hi Rick

the values in column “V” are a drop down list in text format that the user selects, then send the workbook back and I then use the merge vba to bring the data back, at this stage this is when the formula needs to populate correctly to match the updated data
 
Upvote 0
Hi Fluff

thanks very much for your reply, I will try this once I get home, the wife’s dragging me around the shops Christmas shopping at the moment
 
Upvote 0
the values in column “V” are a drop down list in text format that the user selects, then send the workbook back and I then use the merge vba to bring the data back...
I am sorry, but the above is kind of meaningless to me as I do not know anything about your company's business model. With that said, all I really need to know is what is in the cells of Column V at the time you want to run the macro you have asked for. It sounds like it will be constants (non-formulas) so that the blank cells you mentioned will be truly blank (that is empty with absolutely nothing in them). If that is correct, then this macro should also work for you...
Code:
Sub Lost()
  Columns("V").SpecialCells(xlConstants).Offset(, -1).Value = "Lost"
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,746
Messages
6,180,703
Members
452,994
Latest member
Janick

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