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

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

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,136,309
Messages
5,674,996
Members
419,541
Latest member
freddyboots

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