Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Need help with this formula in a macro, please

I can not figure out what is wrong with the following formula when used in a
macro:

ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 &
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)=" & U &
",MID(B4,5,4),MID(B4,5,4))))"

I am using XL 2000 w/ XP.

Thanks for any help,

Roger


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Need help with this formula in a macro, please

what's the value of U at the end of the 2nd row? is it text, ot a variable?

ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 & _
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)=" & U & _
",MID(B4,5,4),MID(B4,5,4))))"


--


Gary


"Roger" wrote in message
...
I can not figure out what is wrong with the following formula when used in
a macro:

ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 &
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)=" & U &
",MID(B4,5,4),MID(B4,5,4))))"

I am using XL 2000 w/ XP.

Thanks for any help,

Roger



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Need help with this formula in a macro, please

The macro is reading part numbers. For eaxmple col B might have a part
number like: U60-04586-1A252, so the U is text.


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
what's the value of U at the end of the 2nd row? is it text, ot a
variable?

ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 & _
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)=" & U &
_
",MID(B4,5,4),MID(B4,5,4))))"


--


Gary


"Roger" wrote in message
...
I can not figure out what is wrong with the following formula when used in
a macro:

ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 &
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)=" & U
& ",MID(B4,5,4),MID(B4,5,4))))"

I am using XL 2000 w/ XP.

Thanks for any help,

Roger





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Need help with this formula in a macro, please

then it probably should have quotes around it. what error are your getting
ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 & _
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)=" & "U" &
_
",MID(B4,5,4),MID(B4,5,4))))"




--


Gary


"Roger" wrote in message
...
The macro is reading part numbers. For eaxmple col B might have a part
number like: U60-04586-1A252, so the U is text.


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
what's the value of U at the end of the 2nd row? is it text, ot a
variable?

ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 & _
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)=" & U
& _
",MID(B4,5,4),MID(B4,5,4))))"


--


Gary


"Roger" wrote in message
...
I can not figure out what is wrong with the following formula when used
in a macro:

ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 &
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)=" & U
& ",MID(B4,5,4),MID(B4,5,4))))"

I am using XL 2000 w/ XP.

Thanks for any help,

Roger







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Need help with this formula in a macro, please

I am getting a run time error 1004 application-defined or object defined
error. If the formula is entered directly into the cell the U will have a
quote around it "U". I can get the macro to enter the formula so that the U
has a quote around it. That is my only problem. It's simple but I can not it
straight.

"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
then it probably should have quotes around it. what error are your
getting
ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 & _
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)=" & "U"
& _
",MID(B4,5,4),MID(B4,5,4))))"




--


Gary


"Roger" wrote in message
...
The macro is reading part numbers. For eaxmple col B might have a part
number like: U60-04586-1A252, so the U is text.


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
what's the value of U at the end of the 2nd row? is it text, ot a
variable?

ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 & _
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)=" & U
& _
",MID(B4,5,4),MID(B4,5,4))))"


--


Gary


"Roger" wrote in message
...
I can not figure out what is wrong with the following formula when used
in a macro:

ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 &
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)=" &
U & ",MID(B4,5,4),MID(B4,5,4))))"

I am using XL 2000 w/ XP.

Thanks for any help,

Roger











  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Need help with this formula in a macro, please

try this

ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 & _
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)=" &
"""U""" & _
",MID(B4,5,4),MID(B4,5,4))))"

--


Gary


"Roger" wrote in message
...
I am getting a run time error 1004 application-defined or object defined
error. If the formula is entered directly into the cell the U will have a
quote around it "U". I can get the macro to enter the formula so that the U
has a quote around it. That is my only problem. It's simple but I can not
it straight.

"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
then it probably should have quotes around it. what error are your
getting
ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 & _
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)=" &
"U" & _
",MID(B4,5,4),MID(B4,5,4))))"




--


Gary


"Roger" wrote in message
...
The macro is reading part numbers. For eaxmple col B might have a part
number like: U60-04586-1A252, so the U is text.


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
what's the value of U at the end of the 2nd row? is it text, ot a
variable?

ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 & _
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)=" &
U & _
",MID(B4,5,4),MID(B4,5,4))))"


--


Gary


"Roger" wrote in message
...
I can not figure out what is wrong with the following formula when used
in a macro:

ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 &
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)=" &
U & ",MID(B4,5,4),MID(B4,5,4))))"

I am using XL 2000 w/ XP.

Thanks for any help,

Roger











  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Need help with this formula in a macro, please

Well, I got the same error message, but I finally got it to work by using:

ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 &
",MID(B4,4,5),IF(MID(B4,1,2)=" _
& 20 & ",MID(B4,4,5),IF(MID(B4,1,1)= _
""U"",MID(B4,5,4),MID(B4,5,4))))"

I got it thanks to your help though, by playing around with the double
quotes. I always get tripped up by quotes in macro formulas.

Thanks for your help, have a great night,

Roger

"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
try this

ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 & _
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)=" &
"""U""" & _
",MID(B4,5,4),MID(B4,5,4))))"

--


Gary


"Roger" wrote in message
...
I am getting a run time error 1004 application-defined or object defined
error. If the formula is entered directly into the cell the U will have a
quote around it "U". I can get the macro to enter the formula so that the
U has a quote around it. That is my only problem. It's simple but I can
not it straight.

"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
then it probably should have quotes around it. what error are your
getting
ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 & _
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)=" &
"U" & _
",MID(B4,5,4),MID(B4,5,4))))"




--


Gary


"Roger" wrote in message
...
The macro is reading part numbers. For eaxmple col B might have a part
number like: U60-04586-1A252, so the U is text.


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
what's the value of U at the end of the 2nd row? is it text, ot a
variable?

ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 & _
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)=" &
U & _
",MID(B4,5,4),MID(B4,5,4))))"


--


Gary


"Roger" wrote in message
...
I can not figure out what is wrong with the following formula when
used in a macro:

ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 &
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)="
& U & ",MID(B4,5,4),MID(B4,5,4))))"

I am using XL 2000 w/ XP.

Thanks for any help,

Roger













  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Need help with this formula in a macro, please

it was probably the word wrap, you would have needed to look at the
underscore character and end the line after each one in my example,
glad you got it working


--


Gary


"Roger" wrote in message
...
Well, I got the same error message, but I finally got it to work by using:

ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 &
",MID(B4,4,5),IF(MID(B4,1,2)=" _
& 20 & ",MID(B4,4,5),IF(MID(B4,1,1)= _
""U"",MID(B4,5,4),MID(B4,5,4))))"

I got it thanks to your help though, by playing around with the double
quotes. I always get tripped up by quotes in macro formulas.

Thanks for your help, have a great night,

Roger

"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
try this

ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 & _
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)=" &
"""U""" & _
",MID(B4,5,4),MID(B4,5,4))))"

--


Gary


"Roger" wrote in message
...
I am getting a run time error 1004 application-defined or object defined
error. If the formula is entered directly into the cell the U will have a
quote around it "U". I can get the macro to enter the formula so that the
U has a quote around it. That is my only problem. It's simple but I can
not it straight.

"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
then it probably should have quotes around it. what error are your
getting
ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 & _
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)=" &
"U" & _
",MID(B4,5,4),MID(B4,5,4))))"




--


Gary


"Roger" wrote in message
...
The macro is reading part numbers. For eaxmple col B might have a part
number like: U60-04586-1A252, so the U is text.


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
what's the value of U at the end of the 2nd row? is it text, ot a
variable?

ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 & _
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)="
& U & _
",MID(B4,5,4),MID(B4,5,4))))"


--


Gary


"Roger" wrote in message
...
I can not figure out what is wrong with the following formula when
used in a macro:

ActiveCell.Formula = "=if(MID(B4,1,2)=" & 29 &
",MID(B4,4,5),IF(MID(B4,1,2)=" & 20 & ",MID(B4,4,5),IF(MID(B4,1,1)="
& U & ",MID(B4,5,4),MID(B4,5,4))))"

I am using XL 2000 w/ XP.

Thanks for any help,

Roger















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
Possible Macro or formula ash3154 Excel Discussion (Misc queries) 2 February 8th 09 01:58 PM
Formula Macro Secret Squirrel Excel Discussion (Misc queries) 7 January 27th 07 04:16 PM
set formula by Macro [email protected] Excel Worksheet Functions 3 December 1st 06 02:02 PM
Do I need a formula or Macro? Sharen Excel Worksheet Functions 2 July 10th 05 05:27 PM
how to run a macro from a formula? davidhub Excel Discussion (Misc queries) 2 July 5th 05 02:42 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"