+ Reply to Thread
Results 1 to 1 of 1

choose different columns with VBA

Hybrid View

torti111 choose different columns with... 04-28-2017, 07:58 AM
  1. #1
    Registered User
    Join Date
    08-27-2015
    Location
    Friedberg
    MS-Off Ver
    2010
    Posts
    68

    choose different columns with VBA

    Hi all,

    With this Code I look into worksheet "DatenSpars". In this worksheet the columns a to m are filled with data.

    If in column H is a date from today I need only the columns A, B, C, D, H, F, I from this lines and copy it
    into worksheet "StopSuspend".
    After that the lines have to be deleted in the worksheet "DatenSpars".

    The only think what not work is the following line, where I select the needed cells:

    .Range(.Cells(I, "A"), .Cells(I, "D"), .Cells(I, "H"), .Cells(I, "F"), .Cells(I, "I")).Copy Sheets("StopSuspend").Range("A" & Rows.Count).End(3)(2)


    Hopefully someone could help?

    I don't know what is wrong in this code?

    Sub StopSuspend()
    Dim I As Long, y
    With Sheets("Daten Spars")
        ReDim y(2 To 1000)
        For I = LBound(y) To UBound(y)
            If .Cells(I, "H") = Date Then
            .Range(.Cells(I, "A"), .Cells(I, "D"), .Cells(I, "H"), .Cells(I, "F"), .Cells(I, "I")).Copy Sheets("StopSuspend").Range("A" & Rows.Count).End(3)(2)
            End If
        Next I
        .Range(.Cells(1, "H"), .Cells(1000, "H")).AutoFilter 1, Date
        On Error Resume Next
        .Range(.Cells(2, "i"), .Cells(1000, "i")).SpecialCells(12).EntireRow.Delete
        On Error GoTo 0
        .AutoFilterMode = False
    End With
    End Sub

    Best regards

    Thorsten
    Last edited by torti111; 05-03-2017 at 09:10 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. SumIf with a criteria and two columns to choose between them
    By djemy1975* in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-06-2016, 12:52 PM
  2. [SOLVED] dynamically choose columns for sumifs
    By onroute in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-20-2015, 04:02 AM
  3. how to choose data from two different columns and put it in a 3rd column
    By luaymaani in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-01-2014, 12:49 PM
  4. Vertical Table (choose your columns)
    By dizzle in forum Excel General
    Replies: 1
    Last Post: 06-28-2013, 01:43 AM
  5. [SOLVED] How to choose strongest anchor from two columns
    By rcurious in forum Excel General
    Replies: 4
    Last Post: 03-29-2013, 02:20 PM
  6. I have two columns 1 & 0 and want to choose those cell with 1 by .
    By Dr. saeed mohtasham nia in forum Excel - New Users/Basics
    Replies: 13
    Last Post: 08-01-2006, 04:40 AM
  7. Can I choose to import only certain columns from a webpage?
    By TronBlaster in forum Excel General
    Replies: 0
    Last Post: 04-05-2006, 12:35 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1