Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I can't test this but, you can try it. I changed a couple of things in your
code: Sub replacingAvalueswithBtext() Dim S As Range LR = Range("A65536").End(xlUp).Row For Each S In Worksheets("s&r").Range("A1",LR) Selection.Replace What:=S.Value, Replacement:=S.Offset(0, 1).Value, LookAt:=xlWhole, SearchOrder:=xlByColumns, MatchCase:=False Next S End Sub "Avel" wrote: Hi all, Tried to reply to an existing discussion topic but it didn't take - I am not much of a programmer, but I have successfully dabbled with VBA in Excel now and again over the years. I am now trying to run a piece of code to take a master list of two columns of data, col A being the original number strings, and col B the replacement text descriptions that I want to swap in, and run the S&R on all cells I had selected in a different worksheet/workbook. I thought the below would work, but it doesn't - what am I doing wrong? Sub replacingAvalueswithBtext() Dim S For Each S In Worksheets("s&r").Range("A1", Range("A65536").End(xlUp).Address) Selection.Replace What:=S.Text, Replacement:=S.Offset(0, 1).Text, LookAt:=xlWhole, SearchOrder:=xlByColumns, MatchCase:=True Next S End Sub Any help much appreciated, or am I just barking up the wrong tree with this? Direct email replies appreciated too, as I am not sure I've subscribed correctly! Thanks in advance for any assistance :) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro error - cant work it out... | Excel Worksheet Functions | |||
Why does the Selection not work | Excel Discussion (Misc queries) | |||
Macro error-"Selection is too large" | Excel Programming | |||
Macro does not work after the program has been restarted in excel.Run time error 2147417848 (80010108) Method visible of object_worksheet failed | Excel Programming | |||
Excel Macro Problem, Add-in need to work in every workbook & Error:9 Subscript out of range | Excel Programming |