Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 213
Default Hiding rows based on user input

I need help fixing the following code. Basically, if the user answers "no",
then I want to hide all of the rows in the worksheet that have a "v" in
column "A". I'm new to VBA but am learning thanks to everyone's help.

Thanks!

Randy

Select Case ProjectSize
Case Is = "l", "m"
resp = MsgBox("Will a vendor be used for this project?",
vbYesNo)

If resp = vbYes Then
vendor = ""
Else
vendor = "v"
For Each row In ActiveSheet.UsedRange.Rows
If row.cell = vendor Then
row.Hidden = True
End If
Next row

End If


End Select
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Hiding rows based on user input

try this. modify range to suit

Sub hidevendor()
Rows.Hidden = False
ans = MsgBox("will a vendor be used", vbYesNo)
If ans = vbNo Then ' MsgBox "hi"
For Each c In Range("a2:a23")
If c = "v" Then c.EntireRow.Hidden = True
Next c
End If
End Sub

--
Don Guillett
SalesAid Software

"Randy" wrote in message
...
I need help fixing the following code. Basically, if the user answers
"no",
then I want to hide all of the rows in the worksheet that have a "v" in
column "A". I'm new to VBA but am learning thanks to everyone's help.

Thanks!

Randy

Select Case ProjectSize
Case Is = "l", "m"
resp = MsgBox("Will a vendor be used for this project?",
vbYesNo)

If resp = vbYes Then
vendor = ""
Else
vendor = "v"
For Each row In ActiveSheet.UsedRange.Rows
If row.cell = vendor Then
row.Hidden = True
End If
Next row

End If


End Select


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
show a number of rows based upon user input P_R Excel Discussion (Misc queries) 1 April 22nd 08 08:03 AM
Hiding worksheets based on user selection HL Excel Worksheet Functions 3 October 12th 06 04:01 PM
Hiding columns based on user/password jmatchus Excel Worksheet Functions 0 January 17th 05 06:49 PM
CODE to select range based on User Input or Value of Input Field Sandi Gauthier Excel Programming 4 December 8th 03 03:22 PM
Hiding worksheets based on user permissions steve Excel Programming 0 August 20th 03 03:55 PM


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