jbesclapez
Active Member
- Joined
- Feb 6, 2010
- Messages
- 275
Hi guys,
I get a vba error and I do not understand why. It says error runtime 91.
It seems to be with the line
InputRngAddress = "Source!$A$1:$A$10"
I hardcoded it but it should be a range. I added the worksheet name too.
Thanks for your help
I get a vba error and I do not understand why. It says error runtime 91.
It seems to be with the line
InputRngAddress = "Source!$A$1:$A$10"
I hardcoded it but it should be a range. I added the worksheet name too.
Thanks for your help
VBA Code:Dim InputRngAddress As Range Dim ReplaceRngAddress As Range Dim LastRowSourceA As Long Dim LastRowDestinationA As Long Dim wss As Worksheet Dim wsd As Worksheet xTitleId = "SonumByNic" Dim Rng As Range 'Source XML Set wss = ActiveWorkbook.Sheets("Source") 'set to current worksheet name LastRowSourceA = wss.Cells(Rows.Count, 1).End(xlUp).Row ' MsgBox "Entered value is " & LastRowSourceA ' InputRngAddress = "Source!$A$1:$A$" & LastRowSourceA InputRngAddress = "Source!$A$1:$A$10" 'MsgBox "Entered value is " & InputRngAddress 'Destination XML Set wsd = ActiveWorkbook.Sheets("Replace") 'set to current worksheet name LastRowDestinationA = wsd.Cells(Rows.Count, 1).End(xlUp).Row ReplaceRngAddress = "Replace!$A$1:$B$" & LastRowDestinationA ' MsgBox "Entered value is " & ReplaceRngAddress Application.ScreenUpdating = False For Each Rng In ReplaceRngAddress.Columns(1).Cells InputRngAddress.Replace what:=Rng.Value, replacement:=Rng.Offset(0, 1).Value Next Application.ScreenUpdating = True