Help with VBA!

Nicolassoong

New Member
Joined
Nov 4, 2019
Messages
2
Good day to all,

As I’m fairly new in VBA.. Appreciate if you could help me on this!

So I have this excel workbook with a set of raw data (workbook1) which i wanna automate to import/copy&paste the data to another workbook (to open workbook2 with dialogbox). Eg:

Cell (A1:J1) (Workbook1) copy & paste data to
Cell (A1:J1) (Workbook2)

Thereafter, the macro will automatically run for the next 235 set of data and offsetting 1 row down. Eg:

Cell (A3:J3) (Workbook1) copy & paste data to
Cell (A3:J3) (Workbook2)
.
.
.
.
.
.
Cell (A235:J235) (Workbook1) copy & paste data to
Cell (A235:J235) (Workbook2)


Thanks in advance!!
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
The easiest way is just to set two range values equivalent to each other.

Code:
workbook2.Sheets(1).range("A3:J235").value =  workbook1.Sheets(1).range("A3:J235").value
 
Upvote 0
Hey! Thanks for responding. But by doing so, does it offset the cells ?

No, to do the offset, you'd need something like this....

Code:
sub copy_em()
Dim ctr as integer

for ctr = 1 to 235 step 2
     workbook2.Sheets(1).range("A" & ctr & ":J" & ctr).value =  workbook1.Sheets(1).range("A" & ctr & ":J" & ctr).value
next ctr

end sub
 
Upvote 0

Forum statistics

Threads
1,215,410
Messages
6,124,749
Members
449,186
Latest member
HBryant

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