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

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
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
.....
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,622
Messages
6,120,585
Members
448,972
Latest member
Shantanu2024

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
Back
Top