Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default Macro to add word to existing text in different worksbooks

Hi,

I'm using a recorded macro which carries out the same set of instructions
for about 50 different workbooks.

My problem is when I've added a bit more to save having to add a word to
existing text manually. The text in each workbook is different but I want to
add "Provisional" at the end.

When I recorded it I just clicked into the cell and pressed F2 and added
text at end but when I looked at the macro it's copying the whole of the line
of text.

If anyone could help with this that would be brilliant

Cheers

--
Mifty
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Macro to add word to existing text in different worksbooks

Please post the code that you need changed.
Thx,
Barb Reinhardt



"Mifty" wrote:

Hi,

I'm using a recorded macro which carries out the same set of instructions
for about 50 different workbooks.

My problem is when I've added a bit more to save having to add a word to
existing text manually. The text in each workbook is different but I want to
add "Provisional" at the end.

When I recorded it I just clicked into the cell and pressed F2 and added
text at end but when I looked at the macro it's copying the whole of the line
of text.

If anyone could help with this that would be brilliant

Cheers

--
Mifty

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default Macro to add word to existing text in different worksbooks

Hi Barb,

I'm just learning (picking it all up from having a go, forums like these and
websites) so never sure if I'm doing ok or not.

I'd got rid of the lines that were replacing my text so have just
re-recorded this bit.
In my recorded code it has picked up the name of the organisation whose
workbook I recorded the macro on so I have replaced with xxxxx here just in
case I breach any confidential stuff (hope that's ok)

Application.Run "PERSONAL.XLS!BenchPickIfs"
Range("A4:J4").Select
ActiveCell.FormulaR1C1 = _
"'Results for 2007 xxxxxxxxxxx [Provisional]"
With ActiveCell.Characters(Start:=1, Length:=85).Font
.Name = "Lucida Sans"
.FontStyle = "Bold"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
End Sub

These are the lines that I have removed

ActiveCell.FormulaR1C1 = _
"'Results for 2007 XXXXXXX [Provisional]"

So what I want to do is just add [Provisional] after xxxxxx which will be
different on each of the workbooks. Not explaining myself too well :-(

Is the code after these two lines just formatting that I could delete to
tidy the code? Not aiming to do that sort of thing now. Just want usable code
but nice to know from someone who understands this stuff.

Many thanks



--
Mifty


"Barb Reinhardt" wrote:

Please post the code that you need changed.
Thx,
Barb Reinhardt



"Mifty" wrote:

Hi,

I'm using a recorded macro which carries out the same set of instructions
for about 50 different workbooks.

My problem is when I've added a bit more to save having to add a word to
existing text manually. The text in each workbook is different but I want to
add "Provisional" at the end.

When I recorded it I just clicked into the cell and pressed F2 and added
text at end but when I looked at the macro it's copying the whole of the line
of text.

If anyone could help with this that would be brilliant

Cheers

--
Mifty

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Macro to add word to existing text in different worksbooks

Select the cells and run:

Sub prov()
For Each r In Selection
r.Value = r.Value & " Provisional"
Next
End Sub

--
Gary''s Student - gsnu200752


"Mifty" wrote:

Hi,

I'm using a recorded macro which carries out the same set of instructions
for about 50 different workbooks.

My problem is when I've added a bit more to save having to add a word to
existing text manually. The text in each workbook is different but I want to
add "Provisional" at the end.

When I recorded it I just clicked into the cell and pressed F2 and added
text at end but when I looked at the macro it's copying the whole of the line
of text.

If anyone could help with this that would be brilliant

Cheers

--
Mifty

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default Macro to add word to existing text in different worksbooks

Many thanks :-)))))
--
Mifty


"Gary''s Student" wrote:

Select the cells and run:

Sub prov()
For Each r In Selection
r.Value = r.Value & " Provisional"
Next
End Sub

--
Gary''s Student - gsnu200752


"Mifty" wrote:

Hi,

I'm using a recorded macro which carries out the same set of instructions
for about 50 different workbooks.

My problem is when I've added a bit more to save having to add a word to
existing text manually. The text in each workbook is different but I want to
add "Provisional" at the end.

When I recorded it I just clicked into the cell and pressed F2 and added
text at end but when I looked at the macro it's copying the whole of the line
of text.

If anyone could help with this that would be brilliant

Cheers

--
Mifty

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
get information from other worksbooks [email protected] Excel Programming 3 May 2nd 06 12:44 PM
Accessing same cell in multiple worksbooks Gopi Excel Programming 1 November 23rd 05 03:24 PM
copy multiple worksheets of a workbook, and paste onto a Word document ( either create new doc file or paste onto an existing file.) I need this done by VBA, Excel Macro Steven Excel Programming 1 October 17th 05 08:56 AM
Open method of worksbooks class failed Ben Excel Programming 5 August 22nd 05 11:16 PM
how do I transfer information from excel to an existing word document using a macro sweetiez1114 Excel Programming 1 July 12th 05 01:38 PM


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