ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to add word to existing text in different worksbooks (https://www.excelbanter.com/excel-programming/400322-macro-add-word-existing-text-different-worksbooks.html)

Mifty

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

Barb Reinhardt

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


Mifty

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


Gary''s Student

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


Mifty

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



All times are GMT +1. The time now is 12:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com