Help with making code for efficient

Sean15

Well-known Member
Joined
Jun 25, 2005
Messages
719
Office Version
  1. 2010
Platform
  1. Windows
Hi:

I adapted codes below from old online codes. Code is supposed to hide all blank rows after last row of data in Column C (well, that’s my intent). The code runs very slow. Also, after executing code, there are two blank rows after the last row of data. Blank rows should be hidden after the code executes. Could someone fix code to?

Make it run faster
Hide all blank rows after last row of data in column C.

VBA Code:
Sub HideRowCellTextValue()

Rows.EntireRow.Hidden = False

Application.ScreenUpdating = False

StartRow = 12

LastRow = 1233

iCol = 3

For i = StartRow To LastRow

If Cells(i, iCol).Value <> "" Then

Cells(i, iCol).EntireRow.Hidden = False

Else

Cells(i, iCol).EntireRow.Hidden = True

End If

Next i

Application.ScreenUpdating = True

End Sub



Thank you for your help.
 
Last edited by a moderator:

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Something else is going on with your code. I ran the macro here and it completed in less than one second.
 
Upvote 0
@Sean15 in future please do not mark a post as the solution when it does not contain one. Thanks
 
Upvote 0

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

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