Divide products into Back ordered and received in Excel with VBA



Warehouse inventory levels. Split a list of products into Back ordered and received in Excel. VBA code included
Add sheets to a workbook. Copy lines based on their value to separate sheets.

Sub addsheets()
Dim erow As Long
Dim i As Integer

Worksheets(“101”).Select
Range(Cells(1, 1), Cells(1, 5)).Copy

‘create a sheet named 101bo
Sheets.Add after:=Sheets(Sheets.Count)
Sheets(ActiveSheet.Name).Name = “101bo”
ActiveSheet.Cells(1, 1).Select
ActiveSheet.Paste
‘create a sheet named rec101
Sheets.Add after:=Sheets(Sheets.Count)
Sheets(ActiveSheet.Name).Name = “rec101”
ActiveSheet.Cells(1, 1).Select
ActiveSheet.Paste

Worksheets(“101”).Select

i = 2
Do While Cells(i, 3) (the symbole for not equal) “”
Range(Cells(i, 1), Cells(i, 5)).Copy
If Cells(i, 4) (symbol for less than) 1 Then

Worksheets(“101bo”).Select
erow = ActiveSheet.Cells(1, 1).CurrentRegion.Rows.Count + 1
ActiveSheet.Cells(erow, 1).Select
ActiveSheet.Paste
Else
Worksheets(“rec101”).Select
erow = ActiveSheet.Cells(1, 1).CurrentRegion.Rows.Count + 1
ActiveSheet.Cells(erow, 1).Select
ActiveSheet.Paste

End If
Worksheets(“101”).Select
i = i + 1
Loop

End Sub

For more help visit my website

I am able to provide online help on your computer for a reasonable rate.

MY videos are all created on Camtasia.

Follow me on Facebook

Watch more new videos about Excel Office | Synthesized by Mindovermetal English

Rate this post

Bài viết liên quan

Theo dõi
Thông báo của
guest
0 Comments
Phản hồi nội tuyến
Xem tất cả bình luận