Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-23-2022, 06:59 AM
JakeD JakeD is offline VBA delete table rows on content control exit Windows 11 VBA delete table rows on content control exit Office 2016
Novice
VBA delete table rows on content control exit
 
Join Date: Aug 2022
Posts: 2
JakeD is on a distinguished road
Default VBA delete table rows on content control exit

Good afternoon,



First time post so please forgive me if it is in the wrong place.

I have a document which has tables, each table having several rows and two columns. The first question in each table is a yes/no answer using a drop down combo box in the right column.

Is there a way to delete all rows under the first row if the question answer is 'no' using a macro based on content control exit?

I have uploaded an example which appears similar to my document. In my document I already have content control on exit for dropdowns tagged as RP which format the cell background colour.

Thanks
Attached Files
File Type: docm Example.docm (20.8 KB, 10 views)
Reply With Quote
  #2  
Old 08-23-2022, 03:42 PM
macropod's Avatar
macropod macropod is offline VBA delete table rows on content control exit Windows 10 VBA delete table rows on content control exit Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,385
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

That could be as simple as:
Code:
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean)
If CCtrl.Range.Text = "No" Then CCtrl.Range.Rows(1).Delete
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA content control on exit delete rows JakeD Word Tables 1 08-23-2022 03:38 PM
VBA delete table rows on content control exit Help please adding a macro to add a table row to a content control table on exit graw76 Word Tables 1 03-26-2021 03:37 PM
VBA Adding Rows To Table With Content Control lord_kaiser Word VBA 2 08-01-2020 01:01 AM
VBA delete table rows on content control exit VBA error Content Control On Exit jec1 Word VBA 5 08-16-2014 08:14 PM
VBA delete table rows on content control exit Deleting a table from a content control -- preserving the content control BrainSlugs83 Word Tables 8 11-14-2013 03:06 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:44 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft