Delete rows below dynamic data

Vbalearning

New Member
Joined
Nov 19, 2015
Messages
2
I am looking to delete rows below the last filled cell in a range. However column A might have 100 filled cells and B may have only 60, meaning the information I need is only rows 1 to 60. Columns where this happens may change but does anyone know a loop function that can detect the information I need and delete the rows below? The problem is I have multiple sheets where I use drag down formulas and some columns are becoming filled unnecessarily leaving column A for example over populated
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
I am looking to delete rows below the last filled cell in a range. However column A might have 100 filled cells and B may have only 60, meaning the information I need is only rows 1 to 60. Columns where this happens may change but does anyone know a loop function that can detect the information I need and delete the rows below? The problem is I have multiple sheets where I use drag down formulas and some columns are becoming filled unnecessarily leaving column A for example over populated
Here's a VBA with which you can choose a column.
Try on test data.
If this isn't what you want perhaps you might provide an example of what you do want.
Code:
Sub xzzx()

Dim q As Long

q = InputBox("Which column? (enter number)")
Range(Rows(Cells(Rows.Count, q).End(xlUp).Row)(2), Rows(Rows.Count)).Delete

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,649
Messages
6,173,585
Members
452,522
Latest member
saeedfiroozei

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