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

I need a macro that can search several workbooks with alerts disabled find a
number say (5-510) in a several cells in several worksheets in each workbook
replace it with a new number say (5-511). Save and close. Also I need to
know which workbooks it changed values in. The name is also in cell c2 on a
Data Entry worksheet.

Thanks for the help.

I've tried several things but couldn't get them to work.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Replace

1) Where are the workbooks names? Or do you want to open all the workbooks
in a folder?
2) How do you want to finjd the numbers
a) Are the number in the a certain column, row, or Range of Cells on
each worksheet. Or the number in specific cells (name the cells).

"Kiba" wrote:

I need a macro that can search several workbooks with alerts disabled find a
number say (5-510) in a several cells in several worksheets in each workbook
replace it with a new number say (5-511). Save and close. Also I need to
know which workbooks it changed values in. The name is also in cell c2 on a
Data Entry worksheet.

Thanks for the help.

I've tried several things but couldn't get them to work.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Replace

1) Its all the workbooks in a folder.
2) They are most likely several places in the workbook, and its going to be
different places in each workbook.

Also the number is probably in a cell with other text.


"Joel" wrote:

1) Where are the workbooks names? Or do you want to open all the workbooks
in a folder?
2) How do you want to finjd the numbers
a) Are the number in the a certain column, row, or Range of Cells on
each worksheet. Or the number in specific cells (name the cells).

"Kiba" wrote:

I need a macro that can search several workbooks with alerts disabled find a
number say (5-510) in a several cells in several worksheets in each workbook
replace it with a new number say (5-511). Save and close. Also I need to
know which workbooks it changed values in. The name is also in cell c2 on a
Data Entry worksheet.

Thanks for the help.

I've tried several things but couldn't get them to work.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Replace

The question is if you search a Range of cells like A1:D100 will other
numbers get changed that shouldn't. Rick's code can be changed easily to
open all the workbooks in the folder. If the incorrect ce3lls may get
changged then you have to be more specific about the range of cells you are
changing.

"Kiba" wrote:

1) Its all the workbooks in a folder.
2) They are most likely several places in the workbook, and its going to be
different places in each workbook.

Also the number is probably in a cell with other text.


"Joel" wrote:

1) Where are the workbooks names? Or do you want to open all the workbooks
in a folder?
2) How do you want to finjd the numbers
a) Are the number in the a certain column, row, or Range of Cells on
each worksheet. Or the number in specific cells (name the cells).

"Kiba" wrote:

I need a macro that can search several workbooks with alerts disabled find a
number say (5-510) in a several cells in several worksheets in each workbook
replace it with a new number say (5-511). Save and close. Also I need to
know which workbooks it changed values in. The name is also in cell c2 on a
Data Entry worksheet.

Thanks for the help.

I've tried several things but couldn't get them to work.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Replace

Are the workbooks open? If so, then perhaps a macro like this will do what
you want...

Sub Find5Dash510()
Dim WB As Workbook
Dim WS As Worksheet
Dim ChangedWBs As String
For Each WB In Workbooks
For Each WS In WB.Worksheets
If Not WS.UsedRange.Find("5-510") Is Nothing Then
WS.UsedRange.Replace "5-510", "5-511"
ChangedWBs = ChangedWBs & WS.Name & vbCrLf
End If
Next
Next
If Len(ChangedWBs) 0 Then
MsgBox "These workbooks were changed:" & vbCrLf & vbCrLf & ChangedWBs
Else
MsgBox "No workbooks were changed."
End If
End Sub

I wasn't sure what you wanted done when you said "the name is also in cell
c2 on a Data Entry worksheet", so I didn't address that in my code. If you
clarify what you wanted, and if the above does what you need, perhaps we can
change the code accordingly.

--
Rick (MVP - Excel)


"Kiba" wrote in message
...
I need a macro that can search several workbooks with alerts disabled find
a
number say (5-510) in a several cells in several worksheets in each
workbook
replace it with a new number say (5-511). Save and close. Also I need to
know which workbooks it changed values in. The name is also in cell c2 on
a
Data Entry worksheet.

Thanks for the help.

I've tried several things but couldn't get them to work.




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
Find and Replace - Replace with Blank Space Studebaker Excel Discussion (Misc queries) 4 April 3rd 23 10:55 AM
Can I replace a ' at the beginning of a text cell using Replace Hilde Excel Discussion (Misc queries) 4 September 10th 07 06:22 PM
How to Replace multiple words to replace using excell ramsun Excel Programming 1 August 10th 06 01:52 PM
find and replace - replace data in rows to separated by commas msdker Excel Worksheet Functions 1 April 15th 06 01:00 AM
How can I use replace(alt+H) for mutiple items needing replace Gery Excel Worksheet Functions 1 June 15th 05 05:51 PM


All times are GMT +1. The time now is 01:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"