Pat_The_Bat

Board Regular
Joined
Jul 12, 2018
Messages
82
I don't understand why I can't resize the selection!!! I figured since HDR2 is a range variable I would be able to just reference the variable object, select it and resize it. I would have thought it would just be

HDR2.resize(0,-2).select

But I keep getting "Application-defined or object-defined error"

any help is greatly appreciated.

Code:
Sheets("Doc List").Activate
        With Sheets("Doc List")
       
           Set HDRAK2 = Range("AK:AK").Find("ASSET")
           Debug.Print HDRAK2.Address
           Set HDR2 = HDRAK2.Offset(, -31)
        
          Debug.Print HDR2.Address
       
      
              
        End With
              
    HDR2.Select
    HDR2.Resize(0, 2).Select
    
    Sheets("Doc List").Range("F7").Resize(0, -1).Select
       
       
       
       
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorLight2
        .TintAndShade = 0.799981688894314
        .PatternTintAndShade = 0
    End With
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
You can't resize by 0,2 -- that means a shape of zero rows(!) by 2 columns.

I had it as resize(,-2) originally.
I put the 0 in there because I was at the point of I'll try anything to try to figure out why I'm getting this error. I've put it back (,-2) and I'm still getting the error.
 
Upvote 0
You can't resize by a minus number and also I wouldn't name a variable the same as a cell reference.
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top