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

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
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,215,032
Messages
6,122,772
Members
449,095
Latest member
m_smith_solihull

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