ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   whats wrong with this? (https://www.excelbanter.com/excel-discussion-misc-queries/129999-whats-wrong.html)

brownti via OfficeKB.com

whats wrong with this?
 
this is my code inside of some other code.

If basedooranswer = "FLUSH HOLLOW CORE" Then
Application.Goto reference:="onepa_ilo_fhc"
Selection.EntireRow.Hidden = False
End If

why doesnt it work?
thanks

--
Message posted via http://www.officekb.com


JE McGimpsey

whats wrong with this?
 
What does "doesnt it work" mean to you?

If

(a) there's a workbook-level named range "onepa_ilo_fhc", or if the
named range is a worksheet-level named range and that worksheet is
active, and

(b) the variable basedooranswer = "FLUSH HOLLOW CORE"

then after the code is run, the sheet containing the referenced range
"onepa_ilo_fhc" should be active and the row(s) referenced by
"onepa_ilo_fhc" should be visible.

Works on a test workbook for me.

However, there are any number of other things that could "not work",
depending on the "other code" and a host of other factors...


In article <6d8e377ecec49@uwe, "brownti via OfficeKB.com" <u31540@uwe
wrote:

this is my code inside of some other code.

If basedooranswer = "FLUSH HOLLOW CORE" Then
Application.Goto reference:="onepa_ilo_fhc"
Selection.EntireRow.Hidden = False
End If

why doesnt it work?
thanks


brownti via OfficeKB.com

whats wrong with this?
 
here is what i have:

a sheet titled "new labels" and a sheet titled "builder" a checkbox on the
sheet builder is supposed to fire the macro:

Sub six_panel()
Application.ScreenUpdating = False
If ("basedooranswer") = "FLUSH HOLLOW CORE" Then
Selection.Goto reference:=("onepa_ilo_fhc")
Selection.EntireRow.Hidden = False
End If
Application.Goto reference:="six_panel"
Selection.EntireRow.Hidden = False
Sheets("builder").Select
Application.ScreenUpdating = True
End Sub

The second part of it works just fine, however it doesnt complete the first
part. "onepa_ilo_fhc" is a row on the sheet "new labels". if more info is
needed i can provide. thanks,



JE McGimpsey wrote:
What does "doesnt it work" mean to you?

If

(a) there's a workbook-level named range "onepa_ilo_fhc", or if the
named range is a worksheet-level named range and that worksheet is
active, and

(b) the variable basedooranswer = "FLUSH HOLLOW CORE"

then after the code is run, the sheet containing the referenced range
"onepa_ilo_fhc" should be active and the row(s) referenced by
"onepa_ilo_fhc" should be visible.

Works on a test workbook for me.

However, there are any number of other things that could "not work",
depending on the "other code" and a host of other factors...

this is my code inside of some other code.

[quoted text clipped - 5 lines]
why doesnt it work?
thanks


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200702/1


JE McGimpsey

whats wrong with this?
 
The text string

"basedooranswer"

(which is NOT a variable) will never equal

"FLUSH HOLLOW CORE"

so the If...Then branch will never be taken.

So fixing it depends on what basedooranswer is supposed to be.

If it's supposed to be a global or module-level variable then you need
to take it out of quotes.


In article <6d90319949a93@uwe, "brownti via OfficeKB.com" <u31540@uwe
wrote:

here is what i have:

a sheet titled "new labels" and a sheet titled "builder" a checkbox on the
sheet builder is supposed to fire the macro:

Sub six_panel()
Application.ScreenUpdating = False
If ("basedooranswer") = "FLUSH HOLLOW CORE" Then
Selection.Goto reference:=("onepa_ilo_fhc")
Selection.EntireRow.Hidden = False
End If
Application.Goto reference:="six_panel"
Selection.EntireRow.Hidden = False
Sheets("builder").Select
Application.ScreenUpdating = True
End Sub

The second part of it works just fine, however it doesnt complete the first
part. "onepa_ilo_fhc" is a row on the sheet "new labels". if more info is
needed i can provide. thanks,



JE McGimpsey wrote:
What does "doesnt it work" mean to you?

If

(a) there's a workbook-level named range "onepa_ilo_fhc", or if the
named range is a worksheet-level named range and that worksheet is
active, and

(b) the variable basedooranswer = "FLUSH HOLLOW CORE"

then after the code is run, the sheet containing the referenced range
"onepa_ilo_fhc" should be active and the row(s) referenced by
"onepa_ilo_fhc" should be visible.

Works on a test workbook for me.

However, there are any number of other things that could "not work",
depending on the "other code" and a host of other factors...

this is my code inside of some other code.

[quoted text clipped - 5 lines]
why doesnt it work?
thanks


brownti via OfficeKB.com

whats wrong with this?
 
its a labeled cell



JE McGimpsey wrote:
The text string

"basedooranswer"

(which is NOT a variable) will never equal

"FLUSH HOLLOW CORE"

so the If...Then branch will never be taken.

So fixing it depends on what basedooranswer is supposed to be.

If it's supposed to be a global or module-level variable then you need
to take it out of quotes.

here is what i have:

[quoted text clipped - 41 lines]
why doesnt it work?
thanks


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200702/1


brownti via OfficeKB.com

whats wrong with this?
 
that is filled out by the answer to an inputbox


brownti wrote:
its a labeled cell

The text string

[quoted text clipped - 16 lines]
why doesnt it work?
thanks


--
Message posted via http://www.officekb.com


brownti via OfficeKB.com

whats wrong with this?
 
Still need some help on this one. Thanks,




brownti wrote:
that is filled out by the answer to an inputbox

its a labeled cell

[quoted text clipped - 3 lines]
why doesnt it work?
thanks


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200702/1


JE McGimpsey

whats wrong with this?
 
Not sure what help you need -

I pointed out that your code uses "basedooranswer" as a string literal.
If it's supposed to be a labeled cell, then you need to use it as the
reference to a range. For instance, instead of

If ("basedooranswer") = "FLUSH HOLLOW CORE" Then

it should be

If ActiveSheet.Range("basedooranswer").Text = _
"FLUSH HOLLOW CORE" Then

or perhaps:

If ActiveWorkbook.Names("basedooranswer").RefersToRan ge.Text = _
"FLUSH HOLLOW CORE"

In article <6db216958b566@uwe, "brownti via OfficeKB.com" <u31540@uwe
wrote:

Still need some help on this one. Thanks,



brownti via OfficeKB.com

whats wrong with this?
 
I just still can't get it to work. Here is the code:

Sub six_panel()
Application.ScreenUpdating = False
If ActiveSheet.Range("basedooranswer").Text = "FLUSH HOLLOW CORE" Then
Sheets("new labels").Select
Application.Goto reference:="onepa_ilo_fhc"
Selection.EntireRow.Hidden = False
End If
Application.Goto reference:="six_panel"
Selection.EntireRow.Hidden = False
Sheets("builder").Select
Application.ScreenUpdating = True
End Sub

When i run the macro everything under the End If works, however the If
statement does not work. I will also be the first to admit I dont know very
much about macros and the code that goes into them. I know what i have
gotten to work in the past and just try to minupulate that code to make it
work in a different context. I also really appreciate all the help I have
been getting. Thanks,



JE McGimpsey wrote:
Not sure what help you need -

I pointed out that your code uses "basedooranswer" as a string literal.
If it's supposed to be a labeled cell, then you need to use it as the
reference to a range. For instance, instead of

If ("basedooranswer") = "FLUSH HOLLOW CORE" Then

it should be

If ActiveSheet.Range("basedooranswer").Text = _
"FLUSH HOLLOW CORE" Then

or perhaps:

If ActiveWorkbook.Names("basedooranswer").RefersToRan ge.Text = _
"FLUSH HOLLOW CORE"

Still need some help on this one. Thanks,


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200702/1


JE McGimpsey

whats wrong with this?
 
If the "If" statement doesn't work, what is in the cell labelled
"basedooranswer"?

Is the sheet that contains "basedooranswer" the active sheet?

Try stepping through the code one line at a time (F8) - what is the
value of ActiveSheet.Range("basedooranswer").Text?


In article <6db281c89adb6@uwe, "brownti via OfficeKB.com" <u31540@uwe
wrote:

I just still can't get it to work. Here is the code:

Sub six_panel()
Application.ScreenUpdating = False
If ActiveSheet.Range("basedooranswer").Text = "FLUSH HOLLOW CORE" Then
Sheets("new labels").Select
Application.Goto reference:="onepa_ilo_fhc"
Selection.EntireRow.Hidden = False
End If
Application.Goto reference:="six_panel"
Selection.EntireRow.Hidden = False
Sheets("builder").Select
Application.ScreenUpdating = True
End Sub

When i run the macro everything under the End If works, however the If
statement does not work.


brownti via OfficeKB.com

whats wrong with this?
 
i think the problem is related to the basedooranswer not being correct. when
i step through it, it goes to the if statement and then skips over the then
part, probably because it thinks the if statement isnt true. the cell
labeled "basedooranswer" is filled with the answer to an inputbox:

Dim myinput As String
myinput = LCase(InputBox("What slab for base price?"))
Range("basedooranswer").Value = UCase(myinput)
If myinput = "6 panel" Then.......

One thing that i noticed is that when i have basedooranswer selected, it says
it as its name in the upper left corner, but when i define name it is
FLUSH_HOLLOW_CORE which is what is entered in the cell. It doesnt seem to
matter what i try, i just cant get it to work out...


JE McGimpsey wrote:
If the "If" statement doesn't work, what is in the cell labelled
"basedooranswer"?

Is the sheet that contains "basedooranswer" the active sheet?

Try stepping through the code one line at a time (F8) - what is the
value of ActiveSheet.Range("basedooranswer").Text?

I just still can't get it to work. Here is the code:

[quoted text clipped - 13 lines]
When i run the macro everything under the End If works, however the If
statement does not work.


--
Message posted via http://www.officekb.com



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

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