Solved

Place text in column cell IF cell is empty AND cell in another column is not

Posted on 2013-01-16
2
350 Views
Last Modified: 2013-01-16
Hi!
I have a spreadsheet I need to insert text into. Column B will always have a date in it. Column D may or may not have text in it. I need a macro that basically does the following:

If Column B <>"", and Column D = "", then insert DPK into Column D's blank cell.

I've looked all over the web and I'm not able to find exactly what I need. Can someone please help?

Thanks!
0
Comment
Question by:McQMom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Accepted Solution

by:
Shanan212 earned 500 total points
ID: 38783826
Sub Macro3()
Dim rRow As Long, i As Long

rRow = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Offset(0, 0).Row

For i = 2 To rRow
    
    If Range("B" & i).value <> "" And Range("D" & i).value = "" Then
        Range("D" & i).Value = "DPK"
    End If
Next i

End Sub

Open in new window


Assumption: Data starts from row 2
0
 

Author Closing Comment

by:McQMom
ID: 38783837
Perfect! Thanks so much for the fast & accurate macro!
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question