Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
How to create a macro to control data flow
I need to create a macro to transfer info from one worksheet to another based
on the input of a certain cell. Example of what I'm trying to do: Workbook 1 Sheet 1: A B C D 1 Name Type ID User If Sheet 1 B3 = Blue, send data in row 3 to sheet 2, next availiable row, and also to Sheet 4 next availiable row. If Sheet 1 B3 = Green, send data in row 3 to sheet 3, next availiable row and also Sheet 4 next availiable row. And I am also creating sheet 5 to do some scheduling and tracking which I can adjust the process as needed. I'd appreciate any help. Thanks, |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
How to create a macro to control data flow
Sub copy2sheets()
Dim i As Long, j as long, s2row As Long, s3row As Long, s4row As Long i = 2 s2row = 2 s3row = 2 s4row = 3 While Sheets("Sheet1").Cells(i, 1) < "" If Sheets("Sheet1").Cells(i, 2) = "Blue" Then For j = 1 To 4 Sheets("Sheet2").Cells(s2row, j).Value = Sheets("Sheet1").Cells(i, j).Value Sheets("Sheet4").Cells(s4row, j).Value = Sheets("Sheet1").Cells(i, j).Value Next j s2row = s2row + 1 s4row = s4row + 1 ElseIf Sheets("Sheet1").Cells(i, 2) = "Green" Then For j = 1 To 4 Sheets("Sheet3").Cells(s3row, j).Value = Sheets("Sheet1").Cells(i, j).Value Sheets("Sheet4").Cells(s4row, j).Value = Sheets("Sheet1").Cells(i, j).Value Next j s3row = s3row + 1 s4row = s4row + 1 End If i = i + 1 Wend End Sub HTH Kostis Vezerides On Mar 28, 4:04*pm, JW_4222 wrote: I need to create a macro to transfer info from one worksheet to another based on the input of a certain cell. Example of what I'm trying to do: Workbook 1 Sheet 1: * * * *A * * * * * B * * * * * C * * * * *D 1 * Name * * Type * * ID * * * * User If * Sheet 1 B3 = Blue, send data in row 3 to sheet 2, next availiable row, and also to Sheet 4 next availiable row. If *Sheet 1 B3 = Green, send data in row 3 to sheet 3, next availiable row and also Sheet 4 next availiable row. And I am also creating sheet 5 to do some scheduling and tracking which I can adjust the process as needed. I'd appreciate any help. Thanks, |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I use excel to create process flow diagrams? | Excel Discussion (Misc queries) | |||
How do I label flow connectors in and excel flow chart? | Excel Discussion (Misc queries) | |||
can you create a cash flow diagram in excel | Charts and Charting in Excel | |||
How do I create a slider bar in Excel to control data input? | Charts and Charting in Excel | |||
How do i create an automatic monthly cash flow from lists of cost. | Excel Discussion (Misc queries) |