its not working,

is it possible i can send you the data sheet

On Oct 12, 7:10 pm, Paul Schreiner <schreiner_p...@att.net> wrote:
> ok... I'm not sure what happened to my last email,
> but I'll try again...
>
> I threw this together.
>
> It saves the email addresses into a "Dictionary Object".
> (I like using them because they are very fast)
>
> It then determines the last entry in the Data sheet
> and works it's way backwords, looking for the string "CustCode:" in
> the first column.  It then inserts a row and then fills the
> new row with the email info.
>
> not elegant, but it works.
> ( I tested it with 2,000 email addresses and 22,000 "fields")
>
> hope this helps,
>
> Paul
> '===============================================================
>
> Sub Add_Address()
>     Dim nRows, curRow, i, AddRow, CustCode
>     Dim Dict_Addr
>     '-------------------------------
>     ' Load Dictionary Object
>     '-------------------------------
>     nRows = 
> Application.WorksheetFunction.CountA(Sheets("User_Addr").Range("A1:A65000")­)
>     Set Dict_Addr = CreateObject("Scripting.Dictionary")
>     Dict_Addr.RemoveAll
>     For i = 2 To nRows
>         Dict_Addr.Add Sheets("User_Addr")..Cells(i, 1).Value, 
> Sheets("User_Addr").Cells(i, 2).Value
>     Next i
>     '-------------------------------
>     ' Loop through Data and add email
>     '-------------------------------
>     nRows = 
> Application.WorksheetFunction.CountA(Sheets("Data").Range("A1:A65000"))
>     AddRow = nRows + 1
>     Application.ScreenUpdating = False
>     For i = nRows To 1 Step -1
>         If i Mod 25 = 0 Then Application.StatusBar = i
>         If (UCase(Sheets("Data").Cells(i, 1).Value) = UCase("CustCode:")) Then
>             CustCode = Cells(i, 2).Value
>             Rows(AddRow).Insert Shift:=xlDown, 
> CopyOrigin:=xlFormatFromLeftOrAbove
>             Sheets("Data").Cells(AddRow, 1) = "email:"
>             Sheets("Data").Cells(AddRow, 2) = Dict_Addr.Item(CustCode)
>             AddRow = i
>         End If
>     Next i
>     Application.ScreenUpdating = False
>     Application.StatusBar = False
> End Sub
>
> ________________________________
> From: Hassan Tariq <htari...@gmail.com>
> To: MS EXCEL AND VBA MACROS <excel-macros@googlegroups.com>
> Sent: Monday, October 12, 2009 4:34:24 AM
> Subject: $$Excel-Macros$$ Macro to insert additional row in previous record 
> with new information
>
> A database of customers includes complete information except the email
> addresses. A new sheet "sheet 2 " is added with Email Addresses in one
> column "b" with Unique Customer Code in Column "A".
>
> Records for some customers use 2 rows and some use more rows.
>
> Printing size restricts addition of columns
>
> Is it possilbe for a macro to insert a new row after each customer
> record in the main sheet and copy email address from the new sheet and
> insert it at the correct customer code.

--~--~---------~--~----~------------~-------~--~----~
----------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe
-~----------~----~----~----~------~----~------~--~---

Reply via email to