+ Reply to Thread
Results 1 to 4 of 4

conditional copy of column to another column of same worksheet

  1. #1
    Registered User
    Join Date
    02-18-2010
    Location
    Pune
    MS-Off Ver
    Excel 2003
    Posts
    9

    conditional copy of column to another column of same worksheet

    Hi,

    Please can anyone assist in my requiremnet which is as
    I need to copy content of column 32, row 3 onwards to any column
    between column 33 to column 256, containning current date.
    Column 33 to 256, row 2 , contain dates of all the coming days.
    If I am running it today(17-Apr-10), column 32 (AF) ROW 3 onwards
    should be copied to any column AI, row 3 onwards.
    ---------------------------------------------------------------------------*---------------------------------------------------------------------------*-------
    COLUMNS AF AH AI
    AJ ............................................
    IV
    Row 1 details blank
    row2 16-apr-10 17-apr-10 18-
    apr-10...............................................
    18-JUL-10
    ROW3 Peter
    row4 Joy
    Row 5 Smith
    Row6 kallis
    ---------------------------------------------------------------------------*---------------------------------------------------------------------------*-------
    My earlier code is not working on all the columns, donot know why ?
    ==========================================================
    #Sub vert()
    Dim lc As Long, sh As Worksheet, rng As Range
    Dim lr As Long, cRng As Range
    Set sh = ActiveSheet
    lc = sh.Cells(2, Columns.Count).End(xlToLeft).Column
    Set rng = sh.Range("C31", sh.Cells(2, lc))
    lr = sh.Cells(Rows.Count, 32).End(xlUp).Row
    Set cRng = sh.Range(sh.Cells(3, 32), Cells(lr, 32))
    For Each c In rng
    If c = Date Then
    cRng.Copy c.Offset(1, 0)
    End If
    Next
    #End Sub
    ============================================
    Regards
    sanjay
    Attached Files Attached Files
    Last edited by sanjay19961; 04-20-2010 at 08:14 AM.

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: conditional copy of column to another column of same worksheet

    Your post does not comply with the Forum Rules regarding use of code tags. All VBA code must be wrapped in code tags.

    Please add the code tags to your last post by clicking on Edit, then highlight the code and press the # button. After you have added the code tags solutions to your question will be suggested. Thanks,

    Rule #3
    Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # button at the top of the post window. If you are editing an existing post, press Go Advanced to see the # button. For more information about these and other tags, click here.
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Registered User
    Join Date
    02-18-2010
    Location
    Pune
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: conditional copy of column to another column of same worksheet

    Hi Palmetto,

    Plese can you help me in solving my above queries .

    Regards
    Sanjay

  4. #4
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: conditional copy of column to another column of same worksheet

    See my previous post regarding use of code tags. Only after you have read and understand the Forum Rules and apply the code tags will solutions be suggested. Use of code tags is strictly enforced in the forum.

+ 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