Results 1 to 3 of 3

Copying Value if other cell value is "ok"

Threaded View

  1. #1
    Registered User
    Join Date
    11-15-2012
    Location
    Berlin
    MS-Off Ver
    Excel 2010
    Posts
    4

    Copying Value if other cell value is "ok"

    Hi there,

    I am currently stuck at some basic vba stuff. I am trying to copy values from column K of sheet 1 to column A in sheet 2, if column A (sheet 1) has the value "ok".

    A try to visualize my problem:

    Sheet 1 (dots are space)
    • Work 1 | work 2 | Number
    • .."ok"...|...........|.234412
    • .."ok"...|...........|.234416
    • .........|...."ok"...|.234418
    where Work 1 = A ; Work 2 = B ; Number = K

    After I use the macro, Sheet 2 should look like this
    • Work 1 | work 2
    • .234412|234418|.
    • .234416|...........|
    • ...........|..........|

    I am currently using this macro, but it won't work
    The list starts at row 16

    Public Sub CopyRows()
        Sheets("AEKOAufstellung").Select
        ' Find the last row of data
        FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
        ' Loop through each row
        For x = 16 To FinalRow Step 1
           ' Decide if to copy based on column K
            ThisValue = Cells(x, 1).Value
            If ThisValue = "ok" Then
                Cells(x, 11).Copy
                Sheets("NeueAEKOs").Select
                NextRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
                Cells(NextRow, 1).Select
                ActiveSheet.Paste
                Sheets("AEKOAufstellung").Select
            End If
        Next x
        Sheets("NeueAEKOs").Select
    End Sub

    I hope you can help me with that, I really don't know what to do
    Last edited by axisambrosia; 11-15-2012 at 08:04 AM.

Thread Information

Users Browsing this Thread

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

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