Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replacing blank cells with info 2

Status
Not open for further replies.
Jul 9, 2007
24
CA
Hello,

I would like to replace blank cells with the value "999" for all rows but only within a specific range of columns.

Is it possible to do so using the following code:
Sheets("Sheet1").Columns("H:K").SpecialCells(xlCellTypeBlanks).??????

...and filling in something else for the question marks?

Thank you,
Marie
 
Sheets("Sheet1").Columns("H:K").SpecialCells(xlCellTypeBlanks).Value = 999

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I'm sure it is better practice to use .Value, but it will work if you just take what you already posted,
Sheets("Sheet1").Columns("H:K").SpecialCells(xlCellTypeBlanks)
and add "= 999", giving you

Sheets("Sheet1").Columns("H:K").SpecialCells(xlCellTypeBlanks) = 999


[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
Thank you both, PH and John.

I went with the .Values, but it did indeed without it too.

I have read that it is good to give as many specifications as possible, as this saves processing time. Could that be said of including .Value, or is it just good 'form' as one may come across instances where the .value need be there?

-Marie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top