Copy cell contents in given order from one workbook to another

selant

Board Regular
Joined
Mar 26, 2009
Messages
109
How can i copy contents of cells in desired format from one workbook to another in the following format with VBA code :

Code:
A!H1 to B!K1
A!H2 to B!L1

A!H3 to B!K2
A!H4 to B!L2

......
.......
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

selant

Board Regular
Joined
Mar 26, 2009
Messages
109
bump. how will i create the offset order in for-next loop ??
 

selant

Board Regular
Joined
Mar 26, 2009
Messages
109
In a for-next loop, how can i make a variable increase 1 by 1, while other variable is increasing by 2.

Code:
a1 > b1
a2 > b3
a3 > b5
.....
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
54,272
Office Version
  1. 365
Platform
  1. Windows
For the question asked in post #1, see if this helps
Code:
Sub selantCopy()
  Dim mySource As Range, cell As Range
  Dim r As Long, c As Long
  
  With Sheets("A")
    Set mySource = .Range("H1", .Range("H" & .Rows.Count).End(xlUp))
  End With
  r = 1
  c = 11
  For Each cell In mySource
    Sheets("B").Cells(r, c).Value = cell.Value
    If c = 12 Then
      c = 11
      r = r + 1
    Else
      c = 12
    End If
  Next cell
End Sub
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,528
Messages
5,832,277
Members
430,125
Latest member
iubrownie

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top