LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default deleting mulitple rows when the checkbox value = true.

I put a bunch of checkboxes from the Forms toolbar -- not the control toolbox
toolbar -- on a worksheet in cells H1:H15.

Then I assigned this macro to each of them:

Option Explicit
Sub testme()
Dim CBX As CheckBox
Set CBX = ActiveSheet.CheckBoxes(Application.Caller)
If CBX.Value = xlOn Then
CBX.TopLeftCell.EntireRow.Resize(1, 7).Delete shift:=xlUp
CBX.Value = xlOff
End If
End Sub

It deletes the data in A:G of that row (if the checkbox is checked). Then
unchecks the checkbox.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Personally, I wouldn't do this.

You'll notice that there is no undo available after the code runs to delete and
shift the data up.

I'd just rightclick on the row header and choose delete row.

burgeee wrote:

im setting up a spreadsheet system for as IT.

i have a series of rows, and at the end of each row theres a checkbox,
linked with a cell, which is either true or false. i also have a button
which, through macros, i would like to be able to delete all the rows that
are checked, by just clicking the remove button.
a) is this possible
b) can i then move all the remaining data up so there are no empty rows,
c) can someone please tell me the visual basic editor for this!

thankyouxxx


--

Dave Peterson
 
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
If one checkbox = true damorrison Excel Discussion (Misc queries) 1 August 26th 06 01:47 PM
Please Help Me with Custom menus Mr BT Excel Worksheet Functions 7 July 4th 06 05:15 PM
Deleting empty rows (special case) Ali Excel Discussion (Misc queries) 1 June 12th 06 07:57 PM
resetting last cell jagdish.eashwar Excel Discussion (Misc queries) 11 March 31st 06 02:06 AM
Deleting rows in a macro in Excel THEFALLGUY Excel Discussion (Misc queries) 4 December 23rd 05 01:59 PM


All times are GMT +1. The time now is 11:32 PM.

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"