VBA check multiple cells if empty put text in cell B

cizzett

Board Regular
Joined
Jan 10, 2019
Messages
121
What I want to do is try to figure out a macro or code that can check if there is data in column D but column Q, R, and T are empty then I want to place the word "New" into column B.

Any Idea's?

Thanks as always
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Place this formula in B1 and copy down: =IF(AND(D1<>"",Q1="",R1="",T1=""),"New","")
 
Upvote 0
Well the problem is there is already a Vlookup in B so I was hoping to make a VBA that can run once, when I run the macro that imports the data from a dump file.
Then id like to add the macro to the button as a call after the first macro so it runs once after the data has migrated to this worksheet and if those cells are empty and D is not empty it puts the "New" into B.

Hope that makes more sense
 
Upvote 0
Try:
Code:
Sub Test()
    Application.ScreenUpdating = False
    Dim LastRow As Long, rng As Range
    LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    For Each rng In Range("D2:D" & LastRow)
        If rng <> "" And rng.Offset(0, 13) = "" And rng.Offset(0, 14) = "" And rng.Offset(0, 16) = "" Then
            rng.Offset(0, -2) = "New"
        End If
    Next rng
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thats exactly what I am looking for except I may not be able to get it to work as the cells have Vlookups in them so its still recognizes the cells as having something in them
 
Upvote 0
Maybe I need to try a macro to get the matching data from the other worksheet and remove the vlookups in those cells.
 
Upvote 0
Misposted
 
Last edited:
Upvote 0
I added a macro to remove all the vlookups before this code but this code still doesn't mark as new
 
Last edited:
Upvote 0
I think that it would be easier to help and test possible solutions if I could work with your actual file which includes any macros you are currently using. Perhaps you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Include a detailed explanation of what you would like to do using a few examples from your data and referring to specific cells, rows, columns and worksheets. If the workbook contains confidential information, you could replace it with generic data.
 
Upvote 0

Forum statistics

Threads
1,223,240
Messages
6,170,951
Members
452,368
Latest member
jayp2104

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