View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Chris Bode[_11_] Chris Bode[_11_] is offline
external usenet poster
 
Posts: 1
Default info mtg criteria from one wkbk to another


Try following code.
Place a command button on the sheet from the control box


Code:
--------------------

Private Sub CommandButton1_Click()
Dim row1 As Integer, col1 As Integer
Dim row2 As Integer, col2 As Integer

row1 = 1
col1 = 1

row2 = 1
col2 = 1

While Workbooks(1).Sheets(1).Cells(row, col).Value < ""

If (Workbooks(1).Sheets(1).Cells(row1, col1 + 1).Value = "513" Or Workbooks(1).Sheets(1).Cells(row1, col1 + 1).Value = "535" Or Workbooks(1).Sheets(1).Cells(row1, col1 + 1).Value = 540 Or Workbooks(1).Sheets(1).Cells(row1, col1 + 1).Value = "560") Then
Workbooks(2).Sheets(1).Cells(row2, col2).Value = Workbooks(1).Sheets(1).Cells(row1, col1).Value
Workbooks(2).Sheets(1).Cells(row2, col2 + 1).Value = Workbooks(1).Sheets(1).Cells(row1, col1 + 1).Value
Workbooks(2).Sheets(1).Cells(row2, col2 + 2).Value = Workbooks(1).Sheets(1).Cells(row1, col1 + 2).Value
Workbooks(2).Sheets(1).Cells(row2, col2 + 3).Value = Workbooks(1).Sheets(1).Cells(row1, col1 + 3).Value
Workbooks(2).Sheets(1).Cells(row2, col2 + 4).Value = Workbooks(1).Sheets(1).Cells(row1, col1 + 4).Value
Workbooks(2).Sheets(1).Cells(row2, col2 + 5).Value = Workbooks(1).Sheets(1).Cells(row1, col1 + 5).Value
Workbooks(2).Sheets(1).Cells(row2, col2 + 6).Value = Workbooks(1).Sheets(1).Cells(row1, col1 + 6).Value
Workbooks(2).Sheets(1).Cells(row2, col2 + 7).Value = Workbooks(1).Sheets(1).Cells(row1, col1 + 7).Value
row2=row2+1
End If
row1 = row1 + 1
Wend
End Sub

--------------------


Hope this helps




--
Chris Bode