Pat_The_Bat
Board Regular
- Joined
- Jul 12, 2018
- Messages
- 83
I am trying to insert a row above the cells that have text values that begin with the word "ASSET", and the same thing for "Income".
I've got my code below working up to a point
It inserts the row above ASSETS and INCOME correctly
then I want to select cells (B?:D?") to format those 3 cells in the row I just inserted
I thought I would just Dim Asset as Range
and then
Set Asset= Range("B:D" & Assets)
but that isn't working. Any help is appreciated.
I've got my code below working up to a point
It inserts the row above ASSETS and INCOME correctly
then I want to select cells (B?:D?") to format those 3 cells in the row I just inserted
I thought I would just Dim Asset as Range
and then
Set Asset= Range("B:D" & Assets)
but that isn't working. Any help is appreciated.
Code:
Sub InsertCats2()
'If Sheets("Publish Doc List").Range("Z1:Z100") = "" Then
Dim Assets As Integer, Income As Integer
With Sheets("Publish Doc List")
Assets = .Range("D:D").Find(what:="ASSETS", after:=.Range("D1")).Row
Income = .Range("D:D").Find(what:="INCOME", after:=.Range("D1"), searchdirection:=xlPrevious).Row
End With
Debug.Print Assets
Debug.Print Income
Range("D" & Assets).EntireRow.Insert
Range("D" & Income).EntireRow.Insert
Dim AssetHDR As Range
Dim IncomeHDR As Range
Set AssetHDR = Range("B:D" & Assets)
Set IncomeHDR = Range("B:D" & Income)
Debug.Print AssetHDR
Debug.Print IncomeHDR