ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   I'm Stumped (https://www.excelbanter.com/excel-programming/362392-im-stumped.html)

ExcelBob[_2_]

I'm Stumped
 

Can anyone tell me how I can use a drop down list of months (april -
march) and use that list to show only certain rows on the worksheet -
depending on what month is selected?

It's a tricky one - help very much appreciated.

ExcelBob


--
ExcelBob
------------------------------------------------------------------------
ExcelBob's Profile: http://www.excelforum.com/member.php...o&userid=34152
View this thread: http://www.excelforum.com/showthread...hreadid=545416


gti_jobert[_114_]

I'm Stumped
 

elaborate....just a little bit on this one so we know exactly what yo
want.

--
gti_jober
-----------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...fo&userid=3063
View this thread: http://www.excelforum.com/showthread.php?threadid=54541


NickHK

I'm Stumped
 
Bob,
Something like, assuming the months are in the first column of data:
Private Sub cboMonths_Click()
Range("rngData").AutoFilter Field:=1, Criteria1:=cboMonths.Text
End Sub

NickHK

"ExcelBob" wrote in
message ...

Can anyone tell me how I can use a drop down list of months (april -
march) and use that list to show only certain rows on the worksheet -
depending on what month is selected?

It's a tricky one - help very much appreciated.

ExcelBob


--
ExcelBob
------------------------------------------------------------------------
ExcelBob's Profile:

http://www.excelforum.com/member.php...o&userid=34152
View this thread: http://www.excelforum.com/showthread...hreadid=545416




DS

I'm Stumped
 
Hi Bob,

not sure if this will help, but if you set a macro in your Worksheet (as
opposed to a Module) to trigger when the value in your drop-down list cell
(assuming you're using Data Validation in a cell), and set this to select
rows based on the value entered, where you define them as Hidden = True, then
this might do the job for you? If there are more to be hidden than unhidden,
if you select valid rows as Hidden = True, then the ones you want visible as
Hidden = False, this will just show the ones you're after.

Like gti_jobert says, if you can provide a little more info, might be able
to come up with something a little more appropriate?

HTH
DS

"ExcelBob" wrote:


Can anyone tell me how I can use a drop down list of months (april -
march) and use that list to show only certain rows on the worksheet -
depending on what month is selected?

It's a tricky one - help very much appreciated.

ExcelBob


--
ExcelBob
------------------------------------------------------------------------
ExcelBob's Profile: http://www.excelforum.com/member.php...o&userid=34152
View this thread: http://www.excelforum.com/showthread...hreadid=545416



ExcelBob[_3_]

I'm Stumped
 

What I've got is about 20 rows in column A with April, May, June, July
etc written in. Then in B3 I have a drop down list of months and when
you select April I want it to show only the 20 rows with April in
column A etc

Autofilter does work to an extent, but I don’t want the user to be able
to show all rows at once (just the rows that relate to the month they
are working on). Plus autofilter displays the months in alphabetical
order which doesn’t look good.

Once a month has been selected data needs to be entered into the
workbook to the right hand side and is then copied onto other sheets
depending on what month is selected.


--
ExcelBob
------------------------------------------------------------------------
ExcelBob's Profile: http://www.excelforum.com/member.php...o&userid=34152
View this thread: http://www.excelforum.com/showthread...hreadid=545416


gti_jobert[_118_]

I'm Stumped
 

dunno....like this:


Code:
--------------------

Private Sub ComboBox_Change()

Application.ScreenUpdating = False

Rows("6:12").Select
Selection.EntireRow.Hidden = True

Select Case ComboBox.Value

Case "January"
Rows("6:8").Select
Selection.EntireRow.Hidden = False

Case "Febuary"
Rows("9:12").Select
Selection.EntireRow.Hidden = False

'etc etc

End Select

Application.ScreenUpdating = True

End Sub

--------------------


HTH


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=545416


Roger Govier

I'm Stumped
 
see reply to your posting in other group

--
Regards

Roger Govier


"ExcelBob" wrote
in message ...

What I've got is about 20 rows in column A with April, May, June, July
etc written in. Then in B3 I have a drop down list of months and when
you select April I want it to show only the 20 rows with April in
column A etc

Autofilter does work to an extent, but I don’t want the user to be
able
to show all rows at once (just the rows that relate to the month they
are working on). Plus autofilter displays the months in alphabetical
order which doesn’t look good.

Once a month has been selected data needs to be entered into the
workbook to the right hand side and is then copied onto other sheets
depending on what month is selected.


--
ExcelBob
------------------------------------------------------------------------
ExcelBob's Profile:
http://www.excelforum.com/member.php...o&userid=34152
View this thread:
http://www.excelforum.com/showthread...hreadid=545416




gti_jobert[_119_]

I'm Stumped
 

this would be better;


Code:
--------------------

Private Sub ComboBox_Change()

Application.ScreenUpdating = False

'Hide All Rows
Rows("6:12").Select
Selection.EntireRow.Hidden = True

'Unhide Rows that match ComboBox value
i = 3
Do
Cells(i, 1).Select
If ActiveCell.Value = ComboBox.Value Then
Rows(i).Select
Selection.EntireRow.Hidden = False
End If
i = i + 1
Loop Until Cells(i, 1).Value = ""


Application.ScreenUpdating = True

End Sub

--------------------


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=545416



All times are GMT +1. The time now is 07:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com