Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Very basic question... I MUST be having a brain fart....

I want to change the content of a string with a user defined function

example:
Cell A1 contains "[firstname], on [date], your order was shipped. [exit1]"
Cell A7 contains "[firstname], Thanks for your order."
ActiveCell.Offset(0, 1) = "Bob"
ActiveCell.Offset(0, 2) = "11/25/2003"

I want to get back "Bob, on 11/25/2003, your order was shipped. Bob, Thanks
for your order."

When I try the below, I get an empty result. When I put a msgbox at the
beginning and the end of the function, it has what I would expect it to, but
nothing gets returned...

How do I pass the value to and get a value from a user defined function????
Where in the helpfile can I find this info?

in my code, I would like to have something like:
stringToExpand = ThisWorkbook.Sheets("Bioler").Range("A1").Value
response = boilerplate( stringToExpand)
msgbox response
--------------------------
function boilerplate
tester = 0
Do While InStr(oldscript, "[") 0
boilerplate = Replace(boilerplate, "[firstname]", ActiveCell.Offset(0, 1))
boilerplate= Replace(boilerplate, "[date]", ActiveCell.Offset(0, 2)))
boilerplate = Replace(boilerplate, "[exit1]",
ThisWorkbook.Sheets("Bioler").Range("A7").Value)
tester = tester + 1
If tester 99 Then
Exit Do
End If
Loop
End Function


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Very basic question... I MUST be having a brain fart....

UDFs cannot affect other cells. All they can do is return a result to the
cell they are in, just like Excel worksheet functions.

--
Jim Rech
Excel MVP


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
Brain fart in simple subtraction Fritz W New Users to Excel 2 November 13th 09 05:22 PM
Very basic VBA question. Cerberus Excel Discussion (Misc queries) 1 July 21st 08 04:30 PM
basic question M121385 New Users to Excel 4 May 6th 08 06:22 PM
Basic question...sorry jen the runner Excel Worksheet Functions 11 September 18th 07 12:12 AM
Basic question plittle Excel Discussion (Misc queries) 1 May 23rd 06 03:49 PM


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