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

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

agihcam

Well-known Member
Joined
Jan 16, 2006
Messages
1,624
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
 

TY1

New Member
Joined
Oct 6, 2006
Messages
2
You are the Man! Worked like a champ.

Thanks a ton.

TY
 

Forum statistics

Threads
1,171,585
Messages
5,876,311
Members
433,193
Latest member
BruxoTrader

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
Top