Consulting

Results 1 to 4 of 4

Thread: Solved: Copy Data that meets criteria

  1. #1

    Solved: Copy Data that meets criteria

    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

    [VBA]
    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" & LRow + 4).Value

    End Sub
    ' If item count is = to zero or "" then do not import
    [/VBA]
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Create a formula that identifies rows to be deleted, then filter by that coloumn, delete visible rows.

  3. #3
    Thanks Bob,
    I will give that a whirl...
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

  4. #4
    Used this method...

    On Error Resume Next ' In case there are no blanks
    Wss.Columns("H:H").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •