View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Annette[_3_] Annette[_3_] is offline
external usenet poster
 
Posts: 32
Default Copy address from one sheet to other sheets

It didn't work ... The code stopped on
Set Rg = Sheets(1).Range(Range("A1"), Range("A65536").End(xlUp))
with error: Application defined or object-defined error .. when I hover
over the line, the rg shows nothing.

Does anyone have some assistance?


"Andoni" wrote in message
om...
Sub AAA()
Dim Cell As Range
Dim Sht As Worksheet

Dim Rg As Range
Set Rg = Sheets(1).Range(Range("A1"), Range("A65536").End(xlUp))
For Each Cell In Rg
For Each Sht In ThisWorkbook.Sheets
If Cell.Value = Sht.Name Then
With Sht
.Visible = True
.Activate
.Rows(1).Insert
.Range("A1").Value = Cell.Offset(0, 1).Value
Exit For
End With
End If
Next Sht
Next Cell
End Sub