Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am having dificulties cyphering this.
'========= Sub Test() Dim rCells As Range, rLoopCells As Range Dim OldAddress As Variant Dim NewAdress As Variant 'Set variable to needed cells If Selection.Cells.Count < 1 Then MsgBox "You must select at least one cell" Else Set rCells = Selection End If For Each rLoopCells In rCells OldAddress = rLoopCells.Address NewAdress = Replace(OldAddress, "A", "D") MsgBox NewAddress 'for testing 'ActiveSheet.Range(NewAdress).Value = ActiveSheet.Range(OldAddress).Value Next rLoopCells End Sub '======= All I want to do is substitute the letter D for the letter A in the address of "OldAddress". I am using msgbox to show results before I destroy my data but all I get is a blank msgbox. What do I have wrong in the above code? (I know the problem lies within the "Replace" statement). -- Regards VBA.Noob.Confused XP Pro Office 2007 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Address must be 18 characters long | Excel Worksheet Functions | |||
How to create a range address with ADDRESS function? | Excel Worksheet Functions | |||
Address can not be more than 30 characters | Excel Worksheet Functions | |||
replace unicode characters | Excel Programming | |||
Replace non printable characters | Excel Worksheet Functions |