View Full Version : Solved: problem filling empty cells
mehdoush
06-29-2009, 10:47 AM
hey guys
i'm using a table that contains 3 columns, Column B sometimes contains blank cells, i want a code that fills in blank cells in column B with "blank" string.
thnks in advance
regards
mehdoush
06-29-2009, 10:47 AM
hey guys
i'm using a table that contains 3 columns, Column B sometimes contains blank cells, i want a code that fills in blank cells in column B with "blank" string.
thnks in advance
regards
bryVA
06-29-2009, 11:09 AM
I am not very knowledgeable about this but you could try something like this:
Public Sub Add_Blank()
Application.ScreenUpdating = False
Range("A1").Select
Do
If ActiveCell.Offset(0, 1) = "" Then
ActiveCell.Offset(0, 1) = "Blank"
End If
ActiveCell.Offset(1, 0).Select
Loop Until ActiveCell = ""
Application.ScreenUpdating = True
End Sub
This assumes that Column A doesn't have blanks.
Hope this helps
georgiboy
06-29-2009, 11:21 AM
Sub FillBlank()
Dim rCell As Range
Dim MyRange As Range
Dim EndRow As Long
EndRow = Range("B" & Rows.Count).End(xlUp).Row
Set MyRange = Range("B2:B" & EndRow)
For Each rCell In MyRange.Cells
If rCell.Value = "" Then
rCell.Value = "blank"
End If
Next rCell
End Sub
mdmackillop
06-29-2009, 11:24 AM
Sub Blanks()
Dim Rw As Long, i As Long
Rw = Cells.Find("*", Range("A1"), , , xlPrevious).Row
For i = 1 To Rw
If Cells(i, 2) = "" Then Cells(i, 2) = "blank"
Next
End Sub
mdmackillop
06-29-2009, 11:28 AM
Threads merged
mehdoush
06-29-2009, 01:52 PM
thank you guys, you're great ;)
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.