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

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

Some videos you may like

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

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
47,926
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
 

Watch MrExcel Video

Forum statistics

Threads
1,122,229
Messages
5,594,944
Members
413,953
Latest member
Arthur1471

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