Script to update inventory.

ItsImpulse

New Member
Joined
Sep 21, 2017
Messages
7
Hi there! I'm not that familiar with using excel macros and formulae but I need help with creating something that will help me update inventory.

Basically I have multiple sheets named Store 1, Store 2 etc. and I have a sheet called summary.

I would need the summary sheet to automatically copy the rows 1,2 and 3 from Store 1, Store 2..... until the last store.

Each store has a different amount of columns so how would I go about doing this?
 
So we want to copy rows 1,2 and three from all sheets in your workbook and put them in sheet named "Summary" is that correct?

Is the Summary sheet sheet(1)
Meaning it is in the far left position on tab bar.

So we can copy all sheets from sheet (2) to last sheet into sheet(1)

And when you say "Automatically" do you mean when you click a button or use a short cut key.

Nothing in Excel happens automatically.
 
Last edited:
Upvote 0
Try this:
Code:
Sub Copy_To_Summary()
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Lastrow = Sheets("Summary").Cells(Rows.Count, "A").End(xlUp).Row + 1
    For i = 1 To Sheets.Count
        If Sheets(i).Name <> "Summary" Then
            Sheets(i).Rows("1:" & 3).Copy Sheets("Summary").Rows(Lastrow)
            Lastrow = Sheets("Summary").Cells(Rows.Count, "A").End(xlUp).Row + 1
        End If
    Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0
sorry I forgot to add. I have another sheet called database inside the workbook but it has nothing to do with the summary
 
Upvote 0
Try this:

Make sure sheet names marked in red are exactly correct. Otherwise modify script.
Code:
Sub Copy_To_Summary()
'Modified 9-21-17 3:00 AM EDT
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Lastrow = Sheets("Summary").Cells(Rows.Count, "A").End(xlUp).Row + 1
    For i = 1 To Sheets.Count
        If Sheets(i).Name <> "[COLOR=#ff0000]Summary[/COLOR]" And Sheets(i).Name <> "[COLOR=#ff0000]database[/COLOR]" Then
            Sheets(i).Rows("1:" & 3).Copy Sheets("Summary").Rows(Lastrow)
            Lastrow = Sheets("Summary").Cells(Rows.Count, "A").End(xlUp).Row + 1
        End If
    Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0
hi sorry for the trouble but it copies row 1 from Store 1, Row 1 from Store 2 and then Roe 1 to 3 from Store 3 and stacks them on top of each other. Can it be row 1 to 3 for all the 3 stores and side by side?
 
Upvote 0
I test all my scripts and it copies rows 1 to 3 from all sheets to the summary sheet.
This is assuming you always have values in column "A"

Do not understand "and side by side"
hi sorry for the trouble but it copies row 1 from Store 1, Row 1 from Store 2 and then Roe 1 to 3 from Store 3 and stacks them on top of each other. Can it be row 1 to 3 for all the 3 stores and side by side?
 
Last edited:
Upvote 0
my bad. there was an empty box. by "side by side I mean that say store 1 has values from A to F and store 2 has values from A to D. I need the summary to have values from A to J. I.e. only rows 1,2 and 3 have data
 
Upvote 0

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