Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-22-2014, 06:47 AM
barryoffshore barryoffshore is offline VBA Code Needed that will Hide / Unhide a row when used with a "Check Box" Windows 7 64bit VBA Code Needed that will Hide / Unhide a row when used with a "Check Box" Office 2013
Novice
VBA Code Needed that will Hide / Unhide a row when used with a "Check Box"
 
Join Date: Jun 2014
Posts: 4
barryoffshore is on a distinguished road
Default VBA Code Needed that will Hide / Unhide a row when used with a "Check Box"

I need a VBA code that will, when used with a Form Control "Check Box", will unhide / hide a row. To be more exact, I'm needing the code to "Hide" row 34 when unchecked and "Unhide" the same row when checked. Can someone help me please. By the way, I'm using Excel 2010. Thank you!!!
Reply With Quote
  #2  
Old 06-22-2014, 11:29 AM
charlesdh charlesdh is offline VBA Code Needed that will Hide / Unhide a row when used with a "Check Box" Windows 7 32bit VBA Code Needed that will Hide / Unhide a row when used with a "Check Box" Office 2010 32bit
Expert
 
Join Date: Apr 2014
Location: Mississippi
Posts: 382
charlesdh is on a distinguished road
Default

Bear,

check your post in MrExcel. Also I sent you a file.
Reply With Quote
  #3  
Old 06-22-2014, 08:13 PM
BobBridges's Avatar
BobBridges BobBridges is offline VBA Code Needed that will Hide / Unhide a row when used with a "Check Box" Windows 7 64bit VBA Code Needed that will Hide / Unhide a row when used with a "Check Box" Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

Barry, I've never hidden a row but I think it's just a matter of setting the row's Height to 0 (and, of course, of restoring its height to something when the box is unchecked). You should be able to confirm this easily: Just record a macro and hide the row manually, then examine the macro that is created. If that doesn't work as expected, let me know what it did do and maybe I can help you figure it out. (Hint: Almost all novices say simply "that didn't work". That's why I specified "let me know what it did do" :-).) Also, let me know if you don't know how to record a macro, or examine it afterward, and I'll walk you through it.
Reply With Quote
  #4  
Old 06-23-2014, 12:10 AM
macropod's Avatar
macropod macropod is offline VBA Code Needed that will Hide / Unhide a row when used with a "Check Box" Windows 7 32bit VBA Code Needed that will Hide / Unhide a row when used with a "Check Box" Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Barry,

Please don't post the same question in multiple locations on this board. I've merged the threads & deleted the duplicate post.

Also cross-posted and solved (before there'd even been a reply here) at http://www.mrexcel.com/forum/excel-questions/786269-visual-basic-applications-code-needed-will-hide-unhide-row-when-used-check-box-2.html
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 06-23-2014, 05:07 AM
barryoffshore barryoffshore is offline VBA Code Needed that will Hide / Unhide a row when used with a "Check Box" Windows 7 64bit VBA Code Needed that will Hide / Unhide a row when used with a "Check Box" Office 2013
Novice
VBA Code Needed that will Hide / Unhide a row when used with a "Check Box"
 
Join Date: Jun 2014
Posts: 4
barryoffshore is on a distinguished road
Default

This is the VBA code I used and it worked great! Of course I had to change a little of the wording to match my sheet.

Private Sub CheckBox1_Click()
Dim check As OLEObject
Set check = Sheets("FEBRUARY").OLEObjects("CheckBox1")
If check.Object Then
Rows("34:34").EntireRow.Hidden = False
Else
Rows("34:34").EntireRow.Hidden = True
End If
End Sub
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Possible to Protect / Hide VBA Macro Code When Transferred to a Different Computer? Duvdev Word VBA 2 04-09-2014 10:56 PM
VBA Code Needed that will Hide / Unhide a row when used with a "Check Box" I need help with macro...code needed for automatic sorting chefmate Excel Programming 1 08-26-2012 01:04 AM
Check box macro help needed Aflac Word 4 03-24-2012 07:11 PM
Hide/Unhide pictures maloneb PowerPoint 1 01-18-2012 03:34 PM
VBA Code Needed that will Hide / Unhide a row when used with a "Check Box" Unhide and Re-hide in Excel 2003 thorgal67 Excel 1 07-16-2009 07:06 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:55 AM.


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