ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   filter list combo box move (https://www.excelbanter.com/excel-programming/411986-filter-list-combo-box-move.html)

Atishoo

filter list combo box move
 
am trying to get a combo box to appear when a specified cell is visble
through selection via a filter list am trying this code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)



With ActiveSheet.CommandButton3
If Workbooks("Ward").Range("B9").Visible = True Then

.Visible = True
.Top = Range("f2").Top
.Left = Range("f2").Left
Else: .Visible = False
End If
End With

End Sub

But excell doesnt like the "if visible = true" I know this works for
envelopevisible but not in this instance!!
any inspiration?

Rick Rothstein \(MVP - VB\)[_2049_]

filter list combo box move
 
I think you will want to change this line...

If Workbooks("Ward").Range("B9").Visible = True Then

to this instead...

If Target.Address = "$B$9" Then

You didn't post enough information for me to know or not, but could you use
Data/Validation (setting the Allow option to List) maybe?

Rick


"Atishoo" wrote in message
...
am trying to get a combo box to appear when a specified cell is visble
through selection via a filter list am trying this code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)



With ActiveSheet.CommandButton3
If Workbooks("Ward").Range("B9").Visible = True Then

.Visible = True
.Top = Range("f2").Top
.Left = Range("f2").Left
Else: .Visible = False
End If
End With

End Sub

But excell doesnt like the "if visible = true" I know this works for
envelopevisible but not in this instance!!
any inspiration?



Atishoo

filter list combo box move
 
Hi rick thanks for your help sorry I didnt give all info.
what i have is a page that lists the patients on different wards these can
be viewed by each ward by selecting the wards from an autofilter drop down
box on the page.
i have a series of email command buttons that will automatically email the
page to the respective wards. To stop people sending the wrong info to the
wrong ward i want only the respective email button to appear when the ward is
chosen from the auto filter list, hence if cell b9 (which contains the name
of ward 1) is visible then command button is visble!!

"Rick Rothstein (MVP - VB)" wrote:

I think you will want to change this line...

If Workbooks("Ward").Range("B9").Visible = True Then

to this instead...

If Target.Address = "$B$9" Then

You didn't post enough information for me to know or not, but could you use
Data/Validation (setting the Allow option to List) maybe?

Rick


"Atishoo" wrote in message
...
am trying to get a combo box to appear when a specified cell is visble
through selection via a filter list am trying this code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)



With ActiveSheet.CommandButton3
If Workbooks("Ward").Range("B9").Visible = True Then

.Visible = True
.Top = Range("f2").Top
.Left = Range("f2").Left
Else: .Visible = False
End If
End With

End Sub

But excell doesnt like the "if visible = true" I know this works for
envelopevisible but not in this instance!!
any inspiration?




Atishoo

filter list combo box move
 
still having no joy with this problem I just need to know how to structure an
if, then command based on weather a certain cell is visible on a page or not

"Atishoo" wrote:

am trying to get a combo box to appear when a specified cell is visble
through selection via a filter list am trying this code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)



With ActiveSheet.CommandButton3
If Workbooks("Ward").Range("B9").Visible = True Then

.Visible = True
.Top = Range("f2").Top
.Left = Range("f2").Left
Else: .Visible = False
End If
End With

End Sub

But excell doesnt like the "if visible = true" I know this works for
envelopevisible but not in this instance!!
any inspiration?


Rick Rothstein \(MVP - VB\)[_2053_]

filter list combo box move
 
Okay, I think I see what you are doing now. Try testing for B9's
"visibility" this way...

If Workbooks("Ward").Range("B9").RowHeight 0 Then

Rick


"Atishoo" wrote in message
...
Hi rick thanks for your help sorry I didnt give all info.
what i have is a page that lists the patients on different wards these can
be viewed by each ward by selecting the wards from an autofilter drop down
box on the page.
i have a series of email command buttons that will automatically email the
page to the respective wards. To stop people sending the wrong info to the
wrong ward i want only the respective email button to appear when the ward
is
chosen from the auto filter list, hence if cell b9 (which contains the
name
of ward 1) is visible then command button is visble!!

"Rick Rothstein (MVP - VB)" wrote:

I think you will want to change this line...

If Workbooks("Ward").Range("B9").Visible = True Then

to this instead...

If Target.Address = "$B$9" Then

You didn't post enough information for me to know or not, but could you
use
Data/Validation (setting the Allow option to List) maybe?

Rick


"Atishoo" wrote in message
...
am trying to get a combo box to appear when a specified cell is visble
through selection via a filter list am trying this code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)



With ActiveSheet.CommandButton3
If Workbooks("Ward").Range("B9").Visible = True Then

.Visible = True
.Top = Range("f2").Top
.Left = Range("f2").Left
Else: .Visible = False
End If
End With

End Sub

But excell doesnt like the "if visible = true" I know this works for
envelopevisible but not in this instance!!
any inspiration?






All times are GMT +1. The time now is 01:34 AM.

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