How to split data with macro

bhandari

Active Member
Joined
Oct 17, 2017
Messages
359
i was looking for emergency help
if i click "Command Button"i like to transfer data from 1sheet to multiple sheets
I have INPUT sheet:which have data in B1:B4
if the name is B6=Ballon
then transfer data to "Ballon" sheet
the data in B1:B4
if B6=Umbrella
then transfer data to "Umbrella" sheet
the data in B1:B4
A1(DATE)=B1
A2(DISCRIPTION)=B2
A3(REF NO)=B3
A4(Link No)=B4
 
Last edited:

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Where in the other sheets do you want to paste B1:B4? Do you want the copy/paste to happen automatically after you enter a value in B6 or do you want to run a macro manually to do the copy/paste?
 
Upvote 0
Where in the other sheets do you want to paste B1:B4? Do you want the copy/paste to happen automatically after you enter a value in B6 or do you want to run a macro manually to do the copy/paste?

catually This is my Orginal Sheet
Please find the LiNK Below
https://drive.google.com/open?id=0B-ZWlAv5DqaEMU9TX3BWOWpSazQ

it have INPUT,KNR-BSCPL,GADAG,NHAI sheets

Input have Date,Letter Discription,Letter No,Ref links
If B6 is linked with data validation..user can select whatever he want eg:NHAI,GADAG..etc
if he select NHAI and clicking "command Button"
whatever the data is given in Input "B2:B5"it must paste in specific sheet tab.
the data must be in end of the row as well make it as transpose


Iam sry for unclear information in #1
 
Upvote 0
i need to submit it with in 5hrs any one can help me out..i hope its simple.
Please solve this asap
 
Upvote 0
Copy and paste this macro into the worksheet code module. Do the following: right click the tab for your Input sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Make a selection in B6 and exit the cell. The copy/pasting will be done automatically.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("B6")) Is Nothing Then Exit Sub
    Range("B2:B5").Copy
    Sheets(Target.Value).Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial Transpose:=True
    Application.CutCopyMode = False
End Sub
 
Upvote 0
Place this macro in a regular module (not in the worksheet code module) and assign it to your command button:
Code:
Sub CopyRange()
    Range("B2:B5").Copy
    Sheets(Range("B6").Value).Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial Transpose:=True
    Application.CutCopyMode = False
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,099
Messages
6,128,822
Members
449,470
Latest member
Subhash Chand

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