ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Replace blank cells with NONE (https://www.excelbanter.com/excel-programming/366622-replace-blank-cells-none.html)

TimT

Replace blank cells with NONE
 
Does anyone know how to cycle through a column or range and replace empty
cells with a value like 0 or NONE? The last row can vary each time...

Here is the code I have so far:

Dim strLstRw As String
strLstRw = ActiveSheet.Range("A65536").End(xlUp).Row


'change empty cells to "NONE"

Range("e11").Select


Do

If IsEmpty(ActiveCell) = True Then

ActiveCell.Value = "NONE"
ActiveCell.Offset(1, 0).Select

End If

Loop Until ActiveCell = "e" & strLstRw


Zone

Replace blank cells with NONE
 
I haven't tested this, but it looks like the last line show be
Loop Until ActiveCell.Address = "$E$" & strLstRw

TimT wrote:
Does anyone know how to cycle through a column or range and replace empty
cells with a value like 0 or NONE? The last row can vary each time...

Here is the code I have so far:

Dim strLstRw As String
strLstRw = ActiveSheet.Range("A65536").End(xlUp).Row


'change empty cells to "NONE"

Range("e11").Select


Do

If IsEmpty(ActiveCell) = True Then

ActiveCell.Value = "NONE"
ActiveCell.Offset(1, 0).Select

End If

Loop Until ActiveCell = "e" & strLstRw



TimT

Replace blank cells with NONE
 
Zone,
I got it...
I used Activecell.row= strLstRw

Thanks brah!

"Zone" wrote:

I haven't tested this, but it looks like the last line show be
Loop Until ActiveCell.Address = "$E$" & strLstRw

TimT wrote:
Does anyone know how to cycle through a column or range and replace empty
cells with a value like 0 or NONE? The last row can vary each time...

Here is the code I have so far:

Dim strLstRw As String
strLstRw = ActiveSheet.Range("A65536").End(xlUp).Row


'change empty cells to "NONE"

Range("e11").Select


Do

If IsEmpty(ActiveCell) = True Then

ActiveCell.Value = "NONE"
ActiveCell.Offset(1, 0).Select

End If

Loop Until ActiveCell = "e" & strLstRw




Dana DeLouis

Replace blank cells with NONE
 
Maybe another idea:

On Error Resume Next 'In case there are no blanks.
Range("A1:A10").SpecialCells(xlCellTypeBlanks) = "None"

--
HTH. :)
Dana DeLouis
Windows XP, Office 2003


"TimT" wrote in message
...
Does anyone know how to cycle through a column or range and replace empty
cells with a value like 0 or NONE? The last row can vary each time...

Here is the code I have so far:

Dim strLstRw As String
strLstRw = ActiveSheet.Range("A65536").End(xlUp).Row


'change empty cells to "NONE"

Range("e11").Select


Do

If IsEmpty(ActiveCell) = True Then

ActiveCell.Value = "NONE"
ActiveCell.Offset(1, 0).Select

End If

Loop Until ActiveCell = "e" & strLstRw





All times are GMT +1. The time now is 01:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com