if cell is empty

If cells G32,G33,G46,G47,J32,J33,J46,J47,M32,M33,M46,M47,P32,P33,P46,P47 and S32,S33,S46,S47 are empty I need to insert the word Care into each of these cells.

Can an expert provide me with VBA to do this please.
JagwarmanAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Saqib Husain, SyedEngineerCommented:
Range("G32,G33,G46,G47,J32,J33,J46,J47,M32,M33,M46,M47,P32,P33,P46,P47,S32,S33,S46,S47").SpecialCells(xlCellTypeBlanks).Value = "Care"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JagwarmanAuthor Commented:
Many thanks Saqib.
0
Haris DulicIT ArchitectCommented:
Hi,

attached is the Excel with function which will test if the cell is empty for supplied range and replace it with supplied replace string..

I prefer for these checks to create functions since the range can change and you can reuse it later on instead of hard coding the ranges...
Book1---Copy.xlsm
0
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

Rob HensonFinance AnalystCommented:
Alternatively, you can do it with formulas.

In four columns that are not currently used but are spaced the same as G, J, M, P and S ie two columns between, in rows 32, 33, 46 & 47:

=IF(G32="","Care","")

You can then copy this whole block and paste special into the required area using Values and Skip Blanks options.

Thanks
Rob H
0
Rodney EndrigaData AnalystCommented:
Here is the VBA code if you would like for the cells you specified:
Sub ee_FillCARE()
Dim rng As Range
Set rng = Range("G32,G33,G46,G47,J32,J33,J46,J47,M32,M33,M46,M47,P32,P33,P46,P47,S32,S33,S46,S47")
For Each cell In rng
    If IsEmpty(cell.Value) Or Trim(cell.Value) = vbNullString Then
        cell.Value = "Care"
    End If
Next cell
End Sub

Open in new window


This will check for Blank cells, SPACES in cells, and empty cells within your specified range and insert the word "Care" accordingly.
0
JagwarmanAuthor Commented:
I really don't like the points system on EE you all deserve top marks but I gave to Saqib Husain, Syed as he came in first and I had already used it.

But thank you all.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.