LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Junior Member
 
Posts: 12
Default Delete unused rows / clear unused rows

Hi Experts!

I am in the process of making a profile book for a work function. I have employees from various levels that will be attending the function. What i am trying to do is have a profile book that they will fill, then have a command button that they can click to delete all fields that do not apply to them. I have some merged cells and I have been struggling with clearing them. I have been able to partially get a delete function to work, however it is deleted almost everything!!! Below is the code I have been working with. Please advise.

I also am struggling on how to make it so the button is visible however will not print once this goes into production.

Private Sub CommandButton2_Click()
Dim nr As Long, i As Long
Application.ScreenUpdating = False
Application.EnableEvents = False 'usually want to disable, but sometimes not
nr = Range("g5:g14").SpecialCells(xlLastCell).Row
For i = nr To 1 Step -1
With Range("g5:g14").Cells(i)
If .Value = "" Then
.EntireRow.Delete
End If
End With
Next i
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
delete unused rows Forgone Excel Programming 2 September 26th 08 03:56 AM
macro to delete hidden or unused rows Cam Excel Programming 1 February 28th 08 08:35 PM
Hiding Unused Rows [email protected] Excel Programming 1 January 19th 07 10:40 PM
Delete Unused (4000) Rows VexedFist[_2_] Excel Programming 3 September 22nd 06 09:54 PM
VB Code to Delete Unused Rows Ken[_18_] Excel Programming 2 October 1st 04 04:35 AM


All times are GMT +1. The time now is 08:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"