+ Reply to Thread
Results 1 to 8 of 8

macro to paste data in alternate cells-pawan

Hybrid View

  1. #1
    Pawan
    Guest

    macro to paste data in alternate cells-pawan

    i want to paste data in alternate cells. e.g. i have following 2 columns:
    A B
    PWV3 DIGOUTHG
    ILA3 DIGOUTHG
    ILB3 DIGOUTHG
    PDE3 DIGOUTHG
    ILC3 DIGOUTHG
    QWR3 DIGOUTHG
    PWV4 DIGOUTHG
    ILA4 DIGOUTHG

    I want to paste PWV3 in row 1 and 3 of column B. Then I want to paste ILA3
    in row 2 and 4 of column B...and so on....it is tedious to do it for large
    numner of rows. Can we write macro for this...

    thank you...

    -Pawan

  2. #2
    Patrick Molloy
    Guest

    RE: macro to paste data in alternate cells-pawan

    so for ILB3, where would that go? you explanation would indicate 3 and 5 but
    that would over-write PWV3.

    "Pawan" wrote:

    > i want to paste data in alternate cells. e.g. i have following 2 columns:
    > A B
    > PWV3 DIGOUTHG
    > ILA3 DIGOUTHG
    > ILB3 DIGOUTHG
    > PDE3 DIGOUTHG
    > ILC3 DIGOUTHG
    > QWR3 DIGOUTHG
    > PWV4 DIGOUTHG
    > ILA4 DIGOUTHG
    >
    > I want to paste PWV3 in row 1 and 3 of column B. Then I want to paste ILA3
    > in row 2 and 4 of column B...and so on....it is tedious to do it for large
    > numner of rows. Can we write macro for this...
    >
    > thank you...
    >
    > -Pawan


  3. #3
    Pawan
    Guest

    RE: macro to paste data in alternate cells-pawan

    Oh..Pratick....
    Unknowingly I wrote in wrong way...
    corrected question is here...

    i want to paste data in alternate cells. e.g. i have following 2 columns:
    > > A B
    > > PWV3 DIGOUTHG
    > > ILA3 DIGOUTHG
    > > ILB3 DIGOUTHG
    > > PDE3 DIGOUTHG
    > > ILC3 DIGOUTHG
    > > QWR3 DIGOUTHG
    > > PWV4 DIGOUTHG
    > > ILA4 DIGOUTHG
    > >
    > > I want to paste PWV3 in row 1 and 3 of column B. Then I want to paste ILA3
    > > in row 4 and 6 of column B...and so on....it is tedious to do it for large
    > > numner of rows. Can we write macro for this...
    > >
    > > thank you...
    > >
    > > -Pawan



    "Patrick Molloy" wrote:

    > so for ILB3, where would that go? you explanation would indicate 3 and 5 but
    > that would over-write PWV3.
    >
    > "Pawan" wrote:
    >
    > > i want to paste data in alternate cells. e.g. i have following 2 columns:
    > > A B
    > > PWV3 DIGOUTHG
    > > ILA3 DIGOUTHG
    > > ILB3 DIGOUTHG
    > > PDE3 DIGOUTHG
    > > ILC3 DIGOUTHG
    > > QWR3 DIGOUTHG
    > > PWV4 DIGOUTHG
    > > ILA4 DIGOUTHG
    > >
    > > I want to paste PWV3 in row 1 and 3 of column B. Then I want to paste ILA3
    > > in row 2 and 4 of column B...and so on....it is tedious to do it for large
    > > numner of rows. Can we write macro for this...
    > >
    > > thank you...
    > >
    > > -Pawan


  4. #4
    Patrick Molloy
    Guest

    RE: macro to paste data in alternate cells-pawan

    Sub Main()
    DIM Index as Long
    DIM rw as Long
    index = 1
    DO Until Cells(rw,1) = ""
    index =index +1
    Cells(index,2) = Cells(rw,1)
    index = index + 2
    Cells(index,2) = Cells(rw,1)

    rw=rw+1
    LOOP
    End Sub

    "Pawan" wrote:

    > Oh..Pratick....
    > Unknowingly I wrote in wrong way...
    > corrected question is here...
    >
    > i want to paste data in alternate cells. e.g. i have following 2 columns:
    > > > A B
    > > > PWV3 DIGOUTHG
    > > > ILA3 DIGOUTHG
    > > > ILB3 DIGOUTHG
    > > > PDE3 DIGOUTHG
    > > > ILC3 DIGOUTHG
    > > > QWR3 DIGOUTHG
    > > > PWV4 DIGOUTHG
    > > > ILA4 DIGOUTHG
    > > >
    > > > I want to paste PWV3 in row 1 and 3 of column B. Then I want to paste ILA3
    > > > in row 4 and 6 of column B...and so on....it is tedious to do it for large
    > > > numner of rows. Can we write macro for this...
    > > >
    > > > thank you...
    > > >
    > > > -Pawan

    >
    >
    > "Patrick Molloy" wrote:
    >
    > > so for ILB3, where would that go? you explanation would indicate 3 and 5 but
    > > that would over-write PWV3.
    > >
    > > "Pawan" wrote:
    > >
    > > > i want to paste data in alternate cells. e.g. i have following 2 columns:
    > > > A B
    > > > PWV3 DIGOUTHG
    > > > ILA3 DIGOUTHG
    > > > ILB3 DIGOUTHG
    > > > PDE3 DIGOUTHG
    > > > ILC3 DIGOUTHG
    > > > QWR3 DIGOUTHG
    > > > PWV4 DIGOUTHG
    > > > ILA4 DIGOUTHG
    > > >
    > > > I want to paste PWV3 in row 1 and 3 of column B. Then I want to paste ILA3
    > > > in row 2 and 4 of column B...and so on....it is tedious to do it for large
    > > > numner of rows. Can we write macro for this...
    > > >
    > > > thank you...
    > > >
    > > > -Pawan


  5. #5
    Pawan
    Guest

    RE: macro to paste data in alternate cells-pawan

    I am not able to do this. It is giving run time error : 1004-Applicatio
    defined or object defined error. Can u pls help me?
    -Pawan

    "Patrick Molloy" wrote:

    > Sub Main()
    > DIM Index as Long
    > DIM rw as Long
    > index = 1
    > DO Until Cells(rw,1) = ""
    > index =index +1
    > Cells(index,2) = Cells(rw,1)
    > index = index + 2
    > Cells(index,2) = Cells(rw,1)
    >
    > rw=rw+1
    > LOOP
    > End Sub
    >
    > "Pawan" wrote:
    >
    > > Oh..Pratick....
    > > Unknowingly I wrote in wrong way...
    > > corrected question is here...
    > >
    > > i want to paste data in alternate cells. e.g. i have following 2 columns:
    > > > > A B
    > > > > PWV3 DIGOUTHG
    > > > > ILA3 DIGOUTHG
    > > > > ILB3 DIGOUTHG
    > > > > PDE3 DIGOUTHG
    > > > > ILC3 DIGOUTHG
    > > > > QWR3 DIGOUTHG
    > > > > PWV4 DIGOUTHG
    > > > > ILA4 DIGOUTHG
    > > > >
    > > > > I want to paste PWV3 in row 1 and 3 of column B. Then I want to paste ILA3
    > > > > in row 4 and 6 of column B...and so on....it is tedious to do it for large
    > > > > numner of rows. Can we write macro for this...
    > > > >
    > > > > thank you...
    > > > >
    > > > > -Pawan

    > >
    > >
    > > "Patrick Molloy" wrote:
    > >
    > > > so for ILB3, where would that go? you explanation would indicate 3 and 5 but
    > > > that would over-write PWV3.
    > > >
    > > > "Pawan" wrote:
    > > >
    > > > > i want to paste data in alternate cells. e.g. i have following 2 columns:
    > > > > A B
    > > > > PWV3 DIGOUTHG
    > > > > ILA3 DIGOUTHG
    > > > > ILB3 DIGOUTHG
    > > > > PDE3 DIGOUTHG
    > > > > ILC3 DIGOUTHG
    > > > > QWR3 DIGOUTHG
    > > > > PWV4 DIGOUTHG
    > > > > ILA4 DIGOUTHG
    > > > >
    > > > > I want to paste PWV3 in row 1 and 3 of column B. Then I want to paste ILA3
    > > > > in row 2 and 4 of column B...and so on....it is tedious to do it for large
    > > > > numner of rows. Can we write macro for this...
    > > > >
    > > > > thank you...
    > > > >
    > > > > -Pawan


  6. #6
    Dave Peterson
    Guest

    Re: macro to paste data in alternate cells-pawan

    I think Patrick forgot to initialize rw.

    Sub Main()
    DIM Index as Long
    DIM rw as Long
    index = 1
    rw = 1 '<-- Added
    DO Until Cells(rw,1) = ""
    index =index +1
    Cells(index,2) = Cells(rw,1)
    index = index + 2
    Cells(index,2) = Cells(rw,1)
    rw=rw+1
    LOOP
    End Sub



    Pawan wrote:
    >
    > I am not able to do this. It is giving run time error : 1004-Applicatio
    > defined or object defined error. Can u pls help me?
    > -Pawan
    >
    > "Patrick Molloy" wrote:
    >
    > > Sub Main()
    > > DIM Index as Long
    > > DIM rw as Long
    > > index = 1
    > > DO Until Cells(rw,1) = ""
    > > index =index +1
    > > Cells(index,2) = Cells(rw,1)
    > > index = index + 2
    > > Cells(index,2) = Cells(rw,1)
    > >
    > > rw=rw+1
    > > LOOP
    > > End Sub
    > >
    > > "Pawan" wrote:
    > >
    > > > Oh..Pratick....
    > > > Unknowingly I wrote in wrong way...
    > > > corrected question is here...
    > > >
    > > > i want to paste data in alternate cells. e.g. i have following 2 columns:
    > > > > > A B
    > > > > > PWV3 DIGOUTHG
    > > > > > ILA3 DIGOUTHG
    > > > > > ILB3 DIGOUTHG
    > > > > > PDE3 DIGOUTHG
    > > > > > ILC3 DIGOUTHG
    > > > > > QWR3 DIGOUTHG
    > > > > > PWV4 DIGOUTHG
    > > > > > ILA4 DIGOUTHG
    > > > > >
    > > > > > I want to paste PWV3 in row 1 and 3 of column B. Then I want to paste ILA3
    > > > > > in row 4 and 6 of column B...and so on....it is tedious to do it for large
    > > > > > numner of rows. Can we write macro for this...
    > > > > >
    > > > > > thank you...
    > > > > >
    > > > > > -Pawan
    > > >
    > > >
    > > > "Patrick Molloy" wrote:
    > > >
    > > > > so for ILB3, where would that go? you explanation would indicate 3 and 5 but
    > > > > that would over-write PWV3.
    > > > >
    > > > > "Pawan" wrote:
    > > > >
    > > > > > i want to paste data in alternate cells. e.g. i have following 2 columns:
    > > > > > A B
    > > > > > PWV3 DIGOUTHG
    > > > > > ILA3 DIGOUTHG
    > > > > > ILB3 DIGOUTHG
    > > > > > PDE3 DIGOUTHG
    > > > > > ILC3 DIGOUTHG
    > > > > > QWR3 DIGOUTHG
    > > > > > PWV4 DIGOUTHG
    > > > > > ILA4 DIGOUTHG
    > > > > >
    > > > > > I want to paste PWV3 in row 1 and 3 of column B. Then I want to paste ILA3
    > > > > > in row 2 and 4 of column B...and so on....it is tedious to do it for large
    > > > > > numner of rows. Can we write macro for this...
    > > > > >
    > > > > > thank you...
    > > > > >
    > > > > > -Pawan


    --

    Dave Peterson

+ 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