Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Taking a subset of a string

Hi,

I'm using Excel 2000 (used to using 97) and not sure how
to do something rather simple. I need to add a number to
the formula of a few cells using '& "+" & x'. However
this may be done multiple times and I don't want the
number to be added each time. Therefore I need to take
all of the formula up to the closing bracket and then add
that string on. But Excel 2000 doesn't use Find for
this! What do I use?? The code I tried is below.

TIA, Rob

Set w = Workbooks("Wastage 2003-04.xls").Worksheets
("Wastage").Cells(359, WeekNo + 3)
w.Formula = Left(w.Formula, Find(")", w.Formula)) & "+" & x

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Taking a subset of a string

w.Formula = Left(w.Formula, Instr(w.Formula,")")) & "+" & x

Demo'd from the immediate window:

set w = Range("A1")
w.formula = "=Sum(B1:B10)"
? w.formula
=SUM(B1:B10)
x =10
w.Formula = Left(w.Formula, Instr(w.Formula,")")) & "+" & x
? w.formula
=SUM(B1:B10)+10
x = 5
w.Formula = Left(w.Formula, Instr(w.Formula,")")) & "+" & x
? w.formula
=SUM(B1:B10)+5

--
Regards,
Tom Ogilvy

"Robert Chapman" wrote in message
...
Hi,

I'm using Excel 2000 (used to using 97) and not sure how
to do something rather simple. I need to add a number to
the formula of a few cells using '& "+" & x'. However
this may be done multiple times and I don't want the
number to be added each time. Therefore I need to take
all of the formula up to the closing bracket and then add
that string on. But Excel 2000 doesn't use Find for
this! What do I use?? The code I tried is below.

TIA, Rob

Set w = Workbooks("Wastage 2003-04.xls").Worksheets
("Wastage").Cells(359, WeekNo + 3)
w.Formula = Left(w.Formula, Find(")", w.Formula)) & "+" & x



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Taking a subset of a string


Many thanks Tom, unfortunately the VBA Help is disabled on
all our work computers so the answer was really
appreciated!

Rob

-----Original Message-----
w.Formula = Left(w.Formula, Instr(w.Formula,")")) & "+" &

x

Demo'd from the immediate window:

set w = Range("A1")
w.formula = "=Sum(B1:B10)"
? w.formula
=SUM(B1:B10)
x =10
w.Formula = Left(w.Formula, Instr(w.Formula,")")) & "+" &

x
? w.formula
=SUM(B1:B10)+10
x = 5
w.Formula = Left(w.Formula, Instr(w.Formula,")")) & "+" &

x
? w.formula
=SUM(B1:B10)+5

--
Regards,
Tom Ogilvy

"Robert Chapman"

wrote in message
...
Hi,

I'm using Excel 2000 (used to using 97) and not sure how
to do something rather simple. I need to add a number

to
the formula of a few cells using '& "+" & x'. However
this may be done multiple times and I don't want the
number to be added each time. Therefore I need to take
all of the formula up to the closing bracket and then

add
that string on. But Excel 2000 doesn't use Find for
this! What do I use?? The code I tried is below.

TIA, Rob

Set w = Workbooks("Wastage 2003-04.xls").Worksheets
("Wastage").Cells(359, WeekNo + 3)
w.Formula = Left(w.Formula, Find(")", w.Formula)) & "+"

& x



.

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
Sum of a subset Gunder Excel Worksheet Functions 2 January 29th 09 01:49 PM
Sum of subset of an array Freeflyer Excel Worksheet Functions 1 June 3rd 08 05:51 PM
Taking out string part which represents date c8tz Excel Worksheet Functions 8 February 2nd 07 01:08 PM
How to enter symbols for subset or element of a subset in Excel? rwcita Excel Worksheet Functions 1 January 23rd 06 09:27 PM
subset of numbers Bernard V Liengme Excel Programming 0 August 7th 03 08:05 PM


All times are GMT +1. The time now is 09:38 PM.

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"