Solved

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

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

here is the link to the original question:-http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_28145987.html

The new question is if I want to repeat the process for columns b, c, d, e, and f....from wkb1 to wkb2....as per my first question...
0
Comment
Question by:route217
  • 8
  • 4
  • 2
14 Comments
 
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")

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

Author Comment

by:route217
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 =""
0
 

Author Comment

by:route217
ID: 39218284
Using excel 2003....
0
 
LVL 43

Expert Comment

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

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

Author Comment

by:route217
ID: 39218320
Ok ssaqibh

slight problem now the macro is copying the sixth cell value in wbk1 and pasting that into wkb2...as 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.
0
 

Author Comment

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

Expert Comment

by:Norie
ID: 39218632
What cells are merged now?
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:route217
ID: 39218665
Hi imnorie

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

Expert Comment

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

Author Comment

by:route217
ID: 39219238
Ssaqibh give me an hour
0
 
LVL 33

Accepted Solution

by:
Norie earned 250 total points
ID: 39219498
route217

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)
          Loop

       Next col

End Sub 

Open in new window

0
 

Author Comment

by:route217
ID: 39219948
Apologies all

Imnorie...thanks it works perfectly fine
0
 
LVL 43

Expert Comment

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

Author Comment

by:route217
ID: 39285157
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now