tonyvee1973
IS-IT--Management
Hi All
Have a spreadsheet with empty cells in which i need to fill with specified values.
I have used the formula below to add zero's to empty cells in the specified range.
Sub Fill_Blanks()
Dim MyCell As Range
For Each MyCell In Range(Selection.Address)
If MyCell = vbNullString Then
MyCell.Value = 0
End If
Next
End Sub
This works great but now i have another issue.
In one column i have a list of codes duplicated several times and now i need to add another 6 codes to the list.
Is there any way i can adapt the formula above to allow me to specify the 6 codes i need to add and get them in the empty spaces i have created for them?
I have tried variations of below but this doesnt work.
Sub Fill_Blanks()
Dim MyCell As Range
For Each MyCell In Range(Selection.Address)
If MyCell = vbNullString Then
MyCell.Value = 55400, 55401, 55402, 55403, 55404, 55405
End If
Next
End Sub
Any help really would be appreciated
Thanks
Have a spreadsheet with empty cells in which i need to fill with specified values.
I have used the formula below to add zero's to empty cells in the specified range.
Sub Fill_Blanks()
Dim MyCell As Range
For Each MyCell In Range(Selection.Address)
If MyCell = vbNullString Then
MyCell.Value = 0
End If
Next
End Sub
This works great but now i have another issue.
In one column i have a list of codes duplicated several times and now i need to add another 6 codes to the list.
Is there any way i can adapt the formula above to allow me to specify the 6 codes i need to add and get them in the empty spaces i have created for them?
I have tried variations of below but this doesnt work.
Sub Fill_Blanks()
Dim MyCell As Range
For Each MyCell In Range(Selection.Address)
If MyCell = vbNullString Then
MyCell.Value = 55400, 55401, 55402, 55403, 55404, 55405
End If
Next
End Sub
Any help really would be appreciated
Thanks