Hi Gary's Student
How do you dim the variables?
I used:
Dim n As Range
Dim i As Integer
Dim v1 As Range
Dim v2 As Range
Dim r As Range
This produced a runtime error 91; object variable or with block
variable not set at n = Sheets("Sheet1").Cells(Rows.Count,
"A").End(xlUp).Row
So a tried,
set n = Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row
This produced a runtime error 424, object required at set n =
Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row
What am I doing wrong?
Dan
So
On Oct 22, 8:59 am, Gary''s Student
<GarysStud...@discussions.microsoft.com> wrote:
> This assumes that the table is in Sheet1 and the report is in Sheet2:
>
> Sub xlator()
> n = Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row
> For i = 1 To n
> v1 = Sheets("Sheet1").Cells(i, 1).Value
> v2 = Sheets("Sheet1").Cells(i, 2).Value
> For Each r In Sheets("Sheet2").UsedRange
> r.Value = Replace(r.Value, v1, v2)
> Next
> Next
> End Sub
>
|