Creating a timestamp from another cell without using If statment

Parkerpen13

New Member
Joined
Feb 26, 2018
Messages
41
I currently have a workbook that when data is entered in column A it will return a time stamp in column I with the help of the if statement. This works great however it makes my workbook very slowwwww. Is there another way or a VBA code that could do this same thing that could improve my workbook?

Current formula

=IF(A1<>"",IF(I201<>"",I1,NOW()),"")
 
Re: Combining two Private Sub Worksheet_Change VBA Codes help

Whose code are you using?
 
Upvote 0

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Re: Combining two Private Sub Worksheet_Change VBA Codes help

The way you have written the code
Code:
    If Not Intersect(Target, Range("G1:G1000")) Is Nothing Then
        Target.Offset(0, -2) = Now
    End
It is looking for a change in column G, and putting the timestamp in column E.
 
Upvote 0
Re: Combining two Private Sub Worksheet_Change VBA Codes help

I am putting data into A column and want to return timestamp to G column. Here is my current code. Thanks for all of your help I am new to this VBA codes.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'    On Error Resume Next
    If Not Intersect(Range("A3:A1000"), Target) Is Nothing Then
      Target.Worksheet.Unprotect Password:="RCFD"
      Target.Locked = True
      Target.Worksheet.Protect Password:="RCFD"
   ElseIf Not Intersect(Target, Range("G1:G1000")) Is Nothing Then
      Target.Worksheet.Unprotect Password:="RCFD"
      Target.Offset(0, -2) = Now
      Target.Worksheet.Protect Password:="RCFD"
   End If
 End Sub
 
Last edited:
Upvote 0
Re: Combining two Private Sub Worksheet_Change VBA Codes help

In that case try
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'    On Error Resume Next
    If Not Intersect(Range("A3:A1000"), Target) Is Nothing Then
      Target.Worksheet.Unprotect Password:="RCFD"
      Target.Locked = True
      Target.Offset(, 6) = Now
      Target.Worksheet.Protect Password:="RCFD"
   End If
 End Sub
 
Upvote 0
Re: Combining two Private Sub Worksheet_Change VBA Codes help

YES Thanks so much it made my workbook sooooo much faster. Thanks for your help.
 
Upvote 0
Re: Combining two Private Sub Worksheet_Change VBA Codes help

Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,329
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top