I'm missing a basic concept here on assigning ranges. What I am trying to do is delete a column that I have pre-defined as a named range.
I have attached a code snippet.
I am getting an error on line:
The range "rptColSubBatch" is a valid range.
I originally defined the range as comprising the entire column E (i.e. "$E:$E")
The error generated was: Runtime Error '13' Type Mismatch
I changed the range to comprise only the first cell in the column (i.e. $E$1)
The error generated for that range was: Runtime Error '1004' Application-defined or Object-defined error
Because I am working with numerous columns that may change, I need to stick with named ranges.
What am I doing wrong?
Public Sub DeleteColumns()
Dim strRange As String
Dim rng As Range
strRange = "rptColSubBatch"
Set rng = Range(strRange)