Hide Rows - VBA Object Required - error 424

toughie

New Member
Joined
Oct 10, 2018
Messages
43
Hi Im getting error object required on this macro below - any ideas? highlighted in red

VBA Code:
Private Sub CommandButton2_Click()

Worksheets("PASTE HUSTLE").Visible = True
Sheets("PASTE HUSTLE").Select
Columns("A:I").Select
Selection.ClearContents
Range("A1").Select
ActiveSheet.PasteSpecial Format:="Text", Link:=False, DisplayAsIcon:= _
False
Sheets("USE THIS").Select
Worksheets("PASTE HUSTLE").Visible = False
End Sub
'On Error GoTo ErrorHandler
For Each c In ActiveSheet.Range("A2:A80").Value
   [COLOR=rgb(184, 49, 47)]     If c.Value = "" Then [/COLOR]
            c.EntireRow.Hidden = True
        Else
            c.EntireRow.Hidden = False
        End If
    Next
'ErrorHandler:
'Exit Sub




End Sub
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Remove .Value from the end of the line above.

Also for information, you can only highlight code that you post if you use '</>RICH' code tags instead of regular vba tags.
 
Upvote 0
Solution
Remove .Value from the end of the line above.

Also for information, you can only highlight code that you post if you use '</>RICH' code tags instead of regular vba tags.
Hi Jasonb75,

That worked a treat! Thanks for the help!


Also ill take the advice for highlighting cells
 
Upvote 0

Forum statistics

Threads
1,214,810
Messages
6,121,690
Members
449,048
Latest member
81jamesacct

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