Reputation: 67
It seems to be fairly simple but I'm struggling...
I have this simple code to select entire row from a black range of cells, which is totally random, base on the current data.
Because the cells F5 F7 F9 F13 are empty, it selects the entire row.
So, I wish to change the value from column 1 [A] and 8 [H] to "Estoque", coloured in light blue.
And I'm stuck on that. Any help, please?
On Error Resume Next
Columns("H:H").SpecialCells(xlCellTypeBlanks).EntireRow.Select
Upvotes: 0
Views: 129
Reputation: 54807
This will write Estoque
to all empty cells of column H
of the used range. It will also write Estoque
to their corresponding cells (cells in the same row) of column A
, regardless of whether they are empty.
Option Explicit
Sub Estoque()
Dim rg As Range
On Error Resume Next
Set rg = Intersect(Range("A:A,H:H"), _
Columns("H:H").SpecialCells(xlCellTypeBlanks).EntireRow)
On Error GoTo 0
If rg Is Nothing Then
MsgBox "Nope!", vbCritical
'Exit Sub
Else
rg.Value = "Estoque"
MsgBox "Estoque!", vbInformation
End If
End Sub
Upvotes: 1