Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
pls pls is offline
external usenet poster
 
Posts: 6
Default Conditional formatting - VBA

i need instruction on a coding problem. i've determined it's not possible to
use conditional formatting to accomplish what i'm trying to achieve.

cell C23 is a drop down menu with choices "yes" and "no"
if c23 is no, i want rows 24-26 to be automatically hidden.

what is the VBA code for this, and how do i input it in the worksheet (step
by step)?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default Conditional formatting - VBA

One way:

Insert this in the worksheet code module (right-click the worksheet tab
and choose View Code):

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Range("24:26").EntireRow.Hidden = (LCase(Range("C23")) = "no")
End Sub



In article ,
pls wrote:

i need instruction on a coding problem. i've determined it's not possible to
use conditional formatting to accomplish what i'm trying to achieve.

cell C23 is a drop down menu with choices "yes" and "no"
if c23 is no, i want rows 24-26 to be automatically hidden.

what is the VBA code for this, and how do i input it in the worksheet (step
by step)?

  #3   Report Post  
Posted to microsoft.public.excel.misc
pls pls is offline
external usenet poster
 
Posts: 6
Default Conditional formatting - VBA

Thanks! if i have additional conditions i want to add, how do i add that to
the code? for example, i tried to add the following before the End Sub, and
got an error:

Range("7:10").EntireRow.Hidden = (LCase(Range("D6")) = "new client")



"JE McGimpsey" wrote:

One way:

Insert this in the worksheet code module (right-click the worksheet tab
and choose View Code):

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Range("24:26").EntireRow.Hidden = (LCase(Range("C23")) = "no")
End Sub



In article ,
pls wrote:

i need instruction on a coding problem. i've determined it's not possible to
use conditional formatting to accomplish what i'm trying to achieve.

cell C23 is a drop down menu with choices "yes" and "no"
if c23 is no, i want rows 24-26 to be automatically hidden.

what is the VBA code for this, and how do i input it in the worksheet (step
by step)?


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default Conditional formatting - VBA

What error do you get - your line of code works fine for me.

In article ,
pls wrote:

Thanks! if i have additional conditions i want to add, how do i add that to
the code? for example, i tried to add the following before the End Sub, and
got an error:

Range("7:10").EntireRow.Hidden = (LCase(Range("D6")) = "new client")

  #5   Report Post  
Posted to microsoft.public.excel.misc
pls pls is offline
external usenet poster
 
Posts: 6
Default Conditional formatting - VBA

nevermind - it's working for me now as well. thanks again for the help.

"JE McGimpsey" wrote:

What error do you get - your line of code works fine for me.

In article ,
pls wrote:

Thanks! if i have additional conditions i want to add, how do i add that to
the code? for example, i tried to add the following before the End Sub, and
got an error:

Range("7:10").EntireRow.Hidden = (LCase(Range("D6")) = "new client")


Reply
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
Protect Cell Formatting including Conditional Formatting Mick Jennings Excel Discussion (Misc queries) 5 November 13th 07 05:32 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 3 January 20th 07 02:02 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 0 January 15th 07 04:35 PM
conditional formatting associates Excel Worksheet Functions 2 June 6th 06 03:05 AM
Conditional Formatting that will display conditional data BrainFart Excel Worksheet Functions 1 September 13th 05 05:45 PM


All times are GMT +1. The time now is 02:10 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"