Hiding a row

TY1

New Member
Joined
Oct 6, 2006
Messages
2
I have numbers listed in column A. They are listed 1 through 10 with 1 being in A-1 and 2 being in A-2 all the way through 10 with 10 being in A-10. If I hide row 5, I want the column to auto populate so column A will now have the numbers listed 1-9. Can anyone help?
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Hi -

Welcome to the board.

semi-auto. hide rows then run the code;

Code:
Sub test()
Dim i As Long
i = Range("a" & Rows.Count).End(xlUp).Row
Range("a1:a" & i).SpecialCells(xlCellTypeVisible).Select
n = 1
For Each c In Selection
    c.Value = n
    n = n + 1
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,629
Messages
6,120,630
Members
448,973
Latest member
ChristineC

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