+ Reply to Thread
Results 1 to 2 of 2

Copying data at specific positions

  1. #1
    Registered User
    Join Date
    01-10-2006
    Posts
    17

    Exclamation Copying data at specific positions

    Hi,

    I want to write a macro for copying perticular cell from worksheet1 to worksheet2 at some specified position only.
    for instance: My data will be there only in the row 2 of Worksheet 1. I want to search which cells contains the value and copy that value in the row 1 of the worksheet2, but at the same column position. i.e. data of column a2 (Worksheet 1) will be copied at a1 position in worksheet 2. b2(Worksheet 1) to b1(Worksheet 2). g2(Worksheet 1) to g1(Worksheet 2) and so on... If any cell is blank then ignore that.

    Thanks,
    Sylvia

  2. #2
    Executor
    Guest

    Re: Copying data at specific positions

    Hi Sylvia,

    I have cooked up:

    Sub SylviasCopy()
    Dim intLook As Integer
    Dim intCol As Integer

    intLook = 10

    For intCol = 1 To 14
    If Worksheets("Sheet1").Cells(2, intCol).Value = intLook Then
    Worksheets("Sheet2").Cells(1, intCol).Value = intLook
    ' Exit For
    End If
    Next

    End Sub

    This will copy all valid values from sheet1 to sheet2
    Top copy only the first valid value remove the character before Exit
    For

    Hoop this helps,

    Executor


+ Reply to Thread

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