YellowLabPro
05-15-2007, 08:41 AM
My little code here places data from one sheet to another.
I am curious if rather than looping through the sheet after the values have been placed and deleting any records that are zero or blank, if initially the record could be skipped, not imported?
If the qty is equal to zero or blank which is in col. D of Wss then do not import
Sub Eastern()
Dim Wss As Worksheet, Wst As Worksheet
Dim Wbsv As String
Dim LRow As Long
'Wbsv = Application.InputBox("Enter Workbook Name", Type:=2)
'Wssv = Application.InputBox("Enter Worksheet Name", Type:=2)
Set Wss = Workbooks("book1.xls").Worksheets("Sheet1")
Set Wst = Workbooks("TGSItemRecordCreatorMaster.xls") _
.Worksheets("Record Creator")
LRow = Wss.Cells(Rows.Count, 3).End(xlUp).Row
Wst.Range("I6:I" & LRow + 4).Value = Wss.Range("C2:C" & LRow + 4).Value
Wst.Range("Z6:Z" & LRow + 4).Value = Wss.Range("F2:F" & LRow + 4).Value
Wst.Range("AC6:AC" & LRow + 4).Value = Wss.Range("D2:D" & LRow + 4).Value
End Sub
' If item count is = to zero or "" then do not import
I am curious if rather than looping through the sheet after the values have been placed and deleting any records that are zero or blank, if initially the record could be skipped, not imported?
If the qty is equal to zero or blank which is in col. D of Wss then do not import
Sub Eastern()
Dim Wss As Worksheet, Wst As Worksheet
Dim Wbsv As String
Dim LRow As Long
'Wbsv = Application.InputBox("Enter Workbook Name", Type:=2)
'Wssv = Application.InputBox("Enter Worksheet Name", Type:=2)
Set Wss = Workbooks("book1.xls").Worksheets("Sheet1")
Set Wst = Workbooks("TGSItemRecordCreatorMaster.xls") _
.Worksheets("Record Creator")
LRow = Wss.Cells(Rows.Count, 3).End(xlUp).Row
Wst.Range("I6:I" & LRow + 4).Value = Wss.Range("C2:C" & LRow + 4).Value
Wst.Range("Z6:Z" & LRow + 4).Value = Wss.Range("F2:F" & LRow + 4).Value
Wst.Range("AC6:AC" & LRow + 4).Value = Wss.Range("D2:D" & LRow + 4).Value
End Sub
' If item count is = to zero or "" then do not import