Link to home
Start Free TrialLog in
Avatar of TEJAS NIMBALKAR
TEJAS NIMBALKAR

asked on

Data copy macro

I need an Excel macro to get data from One sheet to another Sheet.

I have a workbook with Two tabs. Tab 1:- BPTool and Tab 2:- PMG100. In PMG100 Tab from column A I need to copy all the Part numbers from A2 till the end (Numbers keep varying) and paste in BPTool Tab Column A13. For pasting this I need a VBA macro. Can anybody help in this
Avatar of Rob Henson
Rob Henson
Flag of United Kingdom of Great Britain and Northern Ireland image

Try this:

Sub Copy_Parts()

Sheets("PMG100").Range("A:A").ClearContents
For Each Cell In Range("Parts")
r = Cell.Row
v = Cell.Value
Sheets("PMG100").Range("A" & r).Value = v
Next Cell
End Sub

Open in new window


I have also created a dynamic range on BPTool with following formula:

=OFFSET(BPTool!$A$1,0,0,COUNTA(BPTool!$A:$A),1)
Avatar of TEJAS NIMBALKAR
TEJAS NIMBALKAR

ASKER

Thanks for your expert comment, but the code is not working. Actually, I need to pick all the data from the column A from Tab PMG100. Eg:- 1, 2, 3, 4 and so on. It is showing error in this line. "For Each Cell In Range("Parts")". It will be helpful if we replace "parts" with some generic value. So whatever is there is the Column A it should capture in BPTool Tab column A which is starting from 13 row
Did you create the dynamic range?
ASKER CERTIFIED SOLUTION
Avatar of Subodh Tiwari (Neeraj)
Subodh Tiwari (Neeraj)
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Mr. Subodh Toward for the macro help. You have always understand my queries very well.

 Many Thanks once again
You're welcome Tajas!