#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default camper

I'm trying to write the following formula into a cell and keep gettin
the runtime error 1004

Worksheets("Part list").Cells(lgPartListRow
Range("Type").Column).Formula =
"=IF(MID(" & sFindPart & ",5,1)=" & Chr(34) & "W" & Chr(34) & ","
Chr(34) & "F" & Chr(34) & ",MID(" & sFindPart & ",5,1))"

sFind part is a string containing a part # like 2201F060-51
the Mid function works when using the watch windo

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default camper

You need to precede and follow the sFindPart variable with
another Chr(34) in both instances. Set the formula to a
string prior to setting the formula's property value to
it, and then take a look at it in debug and you'll see
what I mean.

HTH.

-Brad

-----Original Message-----
I'm trying to write the following formula into a cell and

keep getting
the runtime error 1004

Worksheets("Part list").Cells(lgPartListRow,
Range("Type").Column).Formula =
"=IF(MID(" & sFindPart & ",5,1)=" & Chr(34) & "W" & Chr

(34) & "," &
Chr(34) & "F" & Chr(34) & ",MID(" & sFindPart & ",5,1))"

sFind part is a string containing a part # like 2201F060-

51
the Mid function works when using the watch window


---
Message posted from http://www.ExcelForum.com/

.

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



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