Hi Jean,
Try:
'=========================
Sub Tester()
Dim rng As Range, rng2 As Range
Dim i As Long
i = Cells(Rows.Count, "G").End(xlUp).Row
Set rng = Range("G1").Resize(i, 2)
On Error Resume Next
Set rng2 = rng.SpecialCells(xlCellTypeBlanks)
On Error GoTo 0
If Not rng2 Is Nothing Then rng2.Value = ",,Open"
End Sub
'<<=========================
---
Regards,
Norman
"Jean" wrote in message
oups.com...
Hi all,
I have some data that I imported from Access into an Excel spreadsheet.
Included in all the columns, are two which contain date values. Some
cells are empty, i.e. there is no date.
What I want to do is replace all the empty cells with the text
,,Open". BUT the tricky part is that I need to do this through VB
code. The hard part is that I dont know beforehand how many records are
imported from Access. If I did know, I could just use some code that
selects the range up to where the first empty cell is met, i.e. like
.Range(.Range("g4"), .Range("h4").End(xlDown))
BUT in my case I have empty cells inside the range already! Therefore I
cannot use that. I was thinking of maybe getting the recordset's
RecordCount property from Access and using that variable to iterate
through the cells in Excel, but thought there may be a less complicated
way of doing this.
Can somebody please suggest a way out of my troubles?
Thanks!
J