Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Copy address from one sheet to other sheets

I think I'm on the tail end of the project, what I need to add for the code
is to add the email address in cell A1 on each spreadsheet based on the tab
name or the name found in cell a1 (both are the same). I have the total
list of offices on sheet1 and the following sheets are broken out based on
information per office, but not all offices are included.

This information changes daily so not all offices will receive a
spreadsheet.

Here's what sheet1 contains:

colA colB
office name email address

--------------------
The following sheets are the different offices and the names are on the tabs
as well as listed in colA of each individual sheet.
-------------------
What I want the macro to do at this point is insert a row on each sheet and
insert the correct email address found on sheet1 that matches the office
address found on colA which matches the address found on the corresponding
sheet.
So if sheet2 was for office Chicago, the macro would insert a row on line
one, and copy and paste the address found on the correct line from sheet1
where the 'chicago' name was found to the new line on sheet 2, then go to
the next spreadsheet and continue until finished.

I hope I explained this clearly. Thanks for your help.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy address from one sheet to other sheets

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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copy address from one sheet to other sheets

Wow .. I am pretty excited to try this tomorrow .. thanks for responding and
I'll let you know how this fares. Thanks again.

"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



  #4   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Sheet to new Sheet and clear cells on original sheets Boiler-Todd Excel Discussion (Misc queries) 7 September 23rd 09 10:02 PM
Copy Sheet to many sheets at once Sunnyskies Excel Discussion (Misc queries) 16 February 8th 07 02:00 PM
Copy from sheet one to several sheets lmagne New Users to Excel 1 October 20th 05 03:03 PM
Copy Name and email address from web sites to excel sheet Philip Excel Discussion (Misc queries) 0 August 10th 05 11:02 AM
in VBA Sheets("mysheet").Copy Befo=Sheets(1) how do i get a reference to the newly created copy of this sheet? Daniel Excel Worksheet Functions 1 July 6th 05 09:57 PM


All times are GMT +1. The time now is 11:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"