*HI VASANT thanks a lot code is working fine in my main data file... this is what i needed u had saved my time and efforts...... thnks again
*Have A Nice Time & Enjoy Life Regards: CMA Ankur Pandey (Someone Different) I'm not the best but i'm not like the rest~~ On Thu, Jul 7, 2011 at 12:42 AM, Rajan_Verma <rajanverma1...@gmail.com>wrote: > *Try this* > > * * > > *Sub MailMerge()* > > *Application.DisplayAlerts = False* > > *Application.ScreenUpdating = False* > > *On Error Resume Next* > > *Dim Form As Worksheet* > > *Dim detail As Worksheet* > > *Dim sh As Worksheet* > > * * > > *Dim rng As Range* > > *Dim cell As Range* > > * * > > *For Each sh In ActiveWorkbook.Sheets* > > *If sh.Name <> "Form" And sh.Name <> "Details" Then sh.Delete* > > *Next* > > * * > > * * > > *Set Form = Sheets("Form")* > > *Set detail = Sheets("Details")* > > *Set rng = detail.Range("A2:A" & detail.UsedRange.Rows.Count)* > > * * > > *result = MsgBox("Do you want to Generate " & detail.Range("F5").Value - > detail.Range("E5").Value + 1 & " Records ", vbYesNo)* > > *If result = 6 Then* > > * * > > * For i = detail.Range("e5").Value + 1 To detail.Range("F5").Value > + 1* > > * Form.Range("b6").Value = detail.Range("A" & i).Offset(0, 2).Value > & detail.Range("A" & i).Offset(0, 3).Value* > > * Form.Range("b7").Value = detail.Range("A" & i).Offset(0, 2).Value > & detail.Range("A" & i).Value* > > * Form.Cells.Copy* > > * Sheets.Add Form* > > * ActiveSheet.Paste* > > * ActiveSheet.Name = detail.Range("A" & i).Value* > > * Application.CutCopyMode = False* > > * * > > * Next* > > *End If* > > *detail.Activate* > > *Application.DisplayAlerts = False* > > *Application.ScreenUpdating = False* > > *End Sub* > > * * > > * * > > *From:* excel-macros@googlegroups.com [mailto: > excel-macros@googlegroups.com] *On Behalf Of *Jai > *Sent:* Wednesday, July 06, 2011 10:45 AM > *To:* excel-macros@googlegroups.com > *Subject:* $$Excel-Macros$$ Maill Merge in Two Excel Sheet**** > > ** ** > > Dear Experts**** > > **** > > i wnat to mail merge From Sheet -2 To Sheet -1, in Sheet -2 , Name, > Desination, & Emp code .**** > > -- > > ---------------------------------------------------------------------------------- > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : > http://twitter.com/exceldailytip > 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 > 3. Excel tutorials at http://www.excel-macros.blogspot.com > 4. Learn VBA Macros at http://www.quickvba.blogspot.com > 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><><><><><><><><> > Like our page on facebook , Just follow below link > http://www.facebook.com/discussexcel**** > > -- > > ---------------------------------------------------------------------------------- > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : > http://twitter.com/exceldailytip > 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 > 3. Excel tutorials at http://www.excel-macros.blogspot.com > 4. Learn VBA Macros at http://www.quickvba.blogspot.com > 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><><><><><><><><> > Like our page on facebook , Just follow below link > http://www.facebook.com/discussexcel > -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel