Sending Data from one spreadsheet to multiple speadsheets

Closed
Pwaluk - Mar 7, 2016 at 09:34 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Mar 7, 2016 at 10:58 AM
Hello,

I am fairly new to VBA and have been searching for a solution for my problem but as yet have not managed to find one.

I wish to send data from one spread sheet to multiple sheets depending upon the number given in column A which would match to the worksheet name to send to.

The multiple spread sheets will be named numerically from 1 onwards and would accumulate overtime, I am wanting all the data in column B to be sent to its relevant worksheet which will named in column A.

Please can you let me know if this is possible.

Many thanks in advance



1 response

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 555
Mar 7, 2016 at 10:58 AM
Hi Pwaluk,

Yes, this is possible.

The code below puts the value found in column B in the sheet mentioned in column A in column B.

Sub RunMe()
Dim MySheet As String
For Each cell In Range("A2:A" & Range("A" & Rows.Count).End(xlUp).Row)
    MySheet = cell.Value
    Sheets(MySheet).Range("B" & Rows.Count).End(xlUp).Offset(1, 0).Value = _
    cell.Offset(0, 1).Value
Next cell
End Sub


Best regards,
Trowa
0