First time poster! I'm working on a VBA Macro that will give me a quantity at any given time based off a transaction ledger. Each transaction is tied to a warehouse denoted by a 2 character alpha numeric value.
Unfortunately, sometimes the Warehouse isn't present in the column, so I want VBA to recognize all blank cells in column D down to the last populated row (off column A) and rename them "Error". I've managed to do this, but if the data I pull in does not contain any blank cells within that range, then it errors out on me and does not continue the macro. My code is below. I'm sure I've made this way more complicated than it needs to be.
LastRowColumnA = Cells(Rows.Count, 1).End(xlUp).Row
Dim r As Range
Set r = Range("D2:D" & LastRowColumnA).Cells.SpecialCells(xlCellTypeBlanks)
r.Formula = "Error"
Range("A1").Select
Unfortunately, sometimes the Warehouse isn't present in the column, so I want VBA to recognize all blank cells in column D down to the last populated row (off column A) and rename them "Error". I've managed to do this, but if the data I pull in does not contain any blank cells within that range, then it errors out on me and does not continue the macro. My code is below. I'm sure I've made this way more complicated than it needs to be.
LastRowColumnA = Cells(Rows.Count, 1).End(xlUp).Row
Dim r As Range
Set r = Range("D2:D" & LastRowColumnA).Cells.SpecialCells(xlCellTypeBlanks)
r.Formula = "Error"
Range("A1").Select