Help with Excel Macro

vidyashankara

New Member
Joined
Mar 24, 2014
Messages
16
I am new to excel and I need to make a macro that reads data from Sheet1 and pastes it into sheet2 successively.

This is how my sheet one looks..

A1 10 1249
A2 13 1232
A3 21 2312
.
.
.
A1 402 12212
A2 432 23323
A3 442 23232
.
.
.

I need Sheet 2 to look like this

A1 10 1249 A2 13 1232 A3 21 2312 . . .
A1 402 12212 A2 432 23323 A3 442 23232 . . . .
.
.
.

How do I write a macro for this? I recorded it using the recorder, and it works only for the first couple of values...
 
Where it says

If Left(MyCell.Value, 3) = "A1" Then


Change to
If Left(MyCell.Value, 2) = "A1" Then
 
Upvote 0

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
I did that, and it still does the same thing... It was initially "A1 ", i change to "A1" and 2 characters and same result...
 
Upvote 0
Ah! I got it, i changed Col +2 to Col +1 and that fixed everything :) thanks a ton!!! You are a superstar!!


.Cells(LastRow2, Col + 0).Value = MyCell(1, 2).Value
.Cells(LastRow2, Col + 1).Value = MyCell(1, 3).Value
 
Upvote 0

Forum statistics

Threads
1,215,172
Messages
6,123,447
Members
449,100
Latest member
sktz

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