copy data from single cell into merged different wkbs - part 2

Posted on 2013-06-04
Last Modified: 2013-06-28
Hi Experts

here is the link to the original question:-

The new question is if I want to repeat the process for columns b, c, d, e, and f....from wkb1 to per my first question...
Question by:route217
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 4
  • 2
LVL 43

Assisted Solution

by:Saqib Husain, Syed
Saqib Husain, Syed earned 250 total points
ID: 39218269
I wonder whether that macro works as explained in the question

If it does then try changing

       Set rngSrc = wb1.Worksheets("Sheet1").Range("A2")
       Set rngDst = wb2.Worksheets("Sheet1").Range("A2")

       Set rngSrc = wb1.Worksheets("Sheet1").Range("A2").resize(,6)
       Set rngDst = wb2.Worksheets("Sheet1").Range("A2").resize(,6)

Author Comment

ID: 39218277
Hi ssaqibh

firstly thanks fir the feedback.  But I am getting a run time error 13...type miss match on line
do until rngSrc.value =""

Author Comment

ID: 39218284
Using excel 2003....
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39218307
Change it to

do until rngSrc.cells(1,1).value =""

Author Comment

ID: 39218320
Ok ssaqibh

slight problem now the macro is copying the sixth cell value in wbk1 and pasting that into the merged cells in wkb2 are in rows of 6....

When the macro should be copying each cell value in rows a2:f until last ccell with value. ...into the merged cells corresponding range wkb2.

Author Comment

ID: 39218561
Any ideas ssaqibh,??? And apologies if u are logged off taking 5 minutes.
LVL 34

Expert Comment

ID: 39218632
What cells are merged now?

Author Comment

ID: 39218665
Hi imnorie

everything works fine I just want to repeat the process for the other mentioned in the above question. ..
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39219167
Can you upload a fake sample for testing?

Author Comment

ID: 39219238
Ssaqibh give me an hour
LVL 34

Accepted Solution

Norie earned 250 total points
ID: 39219498

It would still be good to know what cells are merged.

If you did just want to repeat the code I previously posted then this might work.
Sub CopyToMergedCellsMultiCols()
Dim wb1 As Workbook
Dim wb2 As Workbook
Dim rngSrc As Range
Dim rngDst As Range
Dim col As Long

       Set wb1 = Workbooks("Book1")
       Set wb2 = Workbooks("Book2")

       For col = 1 To wb1.Cells(2, Columns.Count).End(xlToLeft).Column

          Set rngSrc = wb1.Worksheets("Sheet1").Cells(2,col)
          Set rngDst = wb2.Worksheets("Sheet1").Cells(2,col)

          Do Until rngSrc.Value = ""
            rngDst.Value = rngSrc.Value
            Set rngSrc = rngSrc.Offset(1)
            Set rngDst = rngDst.Offset(1)

       Next col

End Sub 

Open in new window


Author Comment

ID: 39219948
Apologies all

Imnorie...thanks it works perfectly fine
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39219959
Are you sure mine works?

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question