+ Reply to Thread
Results 1 to 4 of 4

Move to the next cell if the cell is not blank

  1. #1
    Registered User
    Join Date
    01-03-2023
    Location
    Poland
    MS-Off Ver
    2019
    Posts
    16

    Move to the next cell if the cell is not blank

    Hi All,

    I have a code but I need your help to add some more features here,

    Once the time stamp is added to the column In progress start 1 and In progress end 1 then if i select ' In progress' status for the next time i would like to have the time stamp in the column In progress start 2 and else in column 'In progress end 2' without changing the data in the previous two columns In progress start 1 and In progress end 1

    Could you please help me here?



    Here is the code

    Private Sub Worksheet_Change(ByVal Target As Range)
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ' Event macro to be placed in your Source Workbook
    ' As soon as User fills in data in Column E
    ' and your two conditions are fulfilled , New record is copied
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Dim i As Long, lastrow As Long
    Dim wksh1 As Worksheet, wksh2 As Worksheet
    If Target.Count > 1 Then Exit Sub
    If Target.Column <> 7 Then Exit Sub
    i = Target.Row
    Set wksh1 = ThisWorkbook.Sheets("Sheet1")
    ' Adjust to your specific situation for Destination Names :
    ' Workbook Name AND Worksheet Name
    Set wksh2 = Workbooks("Employee(final).xlsx").Sheets("Sheet1")

    lastrow = wksh2.Cells(Rows.Count, "A").End(xlUp).Row + 1
    If Target.Offset(0, -4).Value >= 43586 Then
    If Target.Offset(0, -3).Value = "Charles" Or Target.Offset(0, -3).Value = "Nicolas" Then
    If Target.Offset(0, 0).Value = "Completed" Then
    ' All tests Passed - Copy Record and Add Flag next to copied record
    Target.Offset(0, 1).Font.Name = "Wingdings"
    Target.Offset(0, 1).Value = "?"
    wksh1.Range("A" & i & ":G" & i).Copy Destination:=wksh2.Range("A" & lastrow)
    End If
    End If
    End If
    If Target.Column = 7 Then
    Select Case Target
    Case "In progress"
    Cells(Target.Row, 9).Value = Date + Time

    Case Else
    Cells(Target.Row, 10).Value = Date + Time

    End Select
    End If
    End Sub


    Screenshot 2023-03-06 163655.png
    Last edited by krvh; 03-06-2023 at 02:18 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    12-01-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2016
    Posts
    949

    Re: Move to the next cell if the cell is not blank

    maybe

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-03-2023
    Location
    Poland
    MS-Off Ver
    2019
    Posts
    16

    Re: Move to the next cell if the cell is not blank

    Hello Mate,

    it works,thank you for the code

    but just a small thing to fix here, whenever I select other options then the stamp is added to the In progress end 1 and end 2 columns, so it would be more logical if there is a line saying that In progress start 1 and start 2 are not empty then add the data in in progress end 1 and end 2 accordingly, could you please help me out here?

    Thank you in advance

  4. #4
    Valued Forum Contributor
    Join Date
    12-01-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2016
    Posts
    949

    Re: Move to the next cell if the cell is not blank

    did you mean like this?

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] if cell is blank, move contents of another cell to blank cell
    By ajanson in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-01-2018, 08:39 AM
  2. [SOLVED] move down column and for every blank cell, clear contents of cell to the left
    By hopefulhart in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-01-2014, 11:23 AM
  3. [SOLVED] Compare cells, If cell is blank move to next cell, ect
    By Mezinov in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-25-2014, 08:29 AM
  4. [SOLVED] Check cell to see if blank if so move value from next column in to the cell.
    By Richard_Thornton in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-14-2014, 06:19 AM
  5. Move filled cell to right and insert blank cell
    By Chemistification in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-18-2011, 08:39 AM
  6. Copy cell, if cell blank move to cell?
    By BobTheRocker in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-14-2010, 04:30 PM
  7. User form to display adjacent cell value and move to next blank cell
    By Ketel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-21-2008, 03:15 PM

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