+ Reply to Thread
Results 1 to 4 of 4

Macro to add constant value

Hybrid View

TimmerSuds I need to incorporate the... 10-10-2010, 01:44 PM
mrice Re: Macro to add constant... 10-10-2010, 03:05 PM
TimmerSuds Re: Macro to add constant... 10-10-2010, 03:37 PM
mrice Re: Macro to add constant... 10-10-2010, 03:55 PM
  1. #1
    Registered User
    Join Date
    06-20-2006
    Location
    Detroit area, Michigan
    MS-Off Ver
    Microsoft Office 365 v16
    Posts
    68
    I need to incorporate the following into an existing macro:

    For any cell in column A (starting with row 2) that is not blank then fill the corresponding cell in column D with 'ABC'

    Any help appreciated

    I need to incorporate the following into an existing macro:

    Note: Column E is a date field...

    For any cell in column E (starting with row 2) that is not blank then perform the following in column F:

    Add one day to Column E and enter the new date into the corresponding row in Column F

    Thanks!
    Last edited by Leith Ross; 10-10-2010 at 02:28 PM.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Macro to add constant value

    Try

    Sub Test()
    For N = 2 To Cells(Rows.Count, 1).End(xlUp).Row
        If Cells(N, 1) <> "" Then Cells(N, 4) = "ABC"
    Next N
    End Sub
    
    Sub Test2()
    For N = 2 To Cells(Rows.Count, 5).End(xlUp).Row
        If Cells(N, 5) <> "" Then Cells(N, 6) = Cells(N, 5) + 1 'Make sure col F is formated as date
    Next N
    End Sub
    Martin

  3. #3
    Registered User
    Join Date
    06-20-2006
    Location
    Detroit area, Michigan
    MS-Off Ver
    Microsoft Office 365 v16
    Posts
    68

    Re: Macro to add constant value

    Quote Originally Posted by mrice View Post
    Try

    Sub Test()
    For N = 2 To Cells(Rows.Count, 1).End(xlUp).Row
        If Cells(N, 1) <> "" Then Cells(N, 4) = "ABC"
    Next N
    End Sub
    
    Sub Test2()
    For N = 2 To Cells(Rows.Count, 5).End(xlUp).Row
        If Cells(N, 5) <> "" Then Cells(N, 6) = Cells(N, 5) + 1 'Make sure col F is formated as date
    Next N
    End Sub
    Thanks a lot - both worked fine...

    Now I need to populate Column M the same way except instead of adding 1 day to another cell, I need to have it add 1 day to today's date.

    I tried this but it didn't work...

    For N = 2 To Cells(Rows.Count, 5).End(xlUp).Row
    If Cells(N, 5) <> "" Then Cells(N, 13) = Today() + 1 'Make sure col F is formated as date
    Next N

    Thanks again

  4. #4
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Macro to add constant value

    Try

    For N = 2 To Cells(Rows.Count, 5).End(xlUp).Row
    If Cells(N, 5) <> "" Then Cells(N, 13) = Date + 1 
    Next N

+ 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