Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
replace doesn't
In XL2000, I use the following sub to update some stuff each month, but the
Replace portion doesn't replace anything :( Cells B42 and G42 contain formulas that link to cells in 'Foodcost.xls' No errors occur, but it's probably some simple syntax problem I can't solve. Any help? Sub Renew() Dim OldMonth As String Dim NewMonth As String Dim wkbk As Workbook Set wkbk = ActiveWorkbook Application.ScreenUpdating = False Workbooks.Open "Foodcost.xls" wkbk.Activate Range("Initial_Qty").Value = Range("On_Hand").Value Range("Added_Used").ClearContents OldMonth = Workbooks("Foodcost.xls").Sheets(5).Name 'i.e. Dec NewMonth = Workbooks("Foodcost.xls").Sheets(6).Name 'i.e. Jan Range("B42,G42").Cells.Replace What:=OldMonth, Replacement:=NewMonth, LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False Workbooks("Foodcost.xls").Close Application.ScreenUpdating = True End Sub -- David |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find and Replace - Replace with Blank Space | Excel Discussion (Misc queries) | |||
Can I replace a ' at the beginning of a text cell using Replace | Excel Discussion (Misc queries) | |||
Replace dialog should put focus on "Find What" not "Replace With" | Excel Discussion (Misc queries) | |||
find and replace - replace data in rows to separated by commas | Excel Worksheet Functions | |||
How can I use replace(alt+H) for mutiple items needing replace | Excel Worksheet Functions |