time interval

earp_

Active Member
Joined
Apr 30, 2008
Messages
305
Hi I have this problem,
in cell A2 of sheet1 there is a timestamp in this format
12:00:00 PM
When cell A2 of sheet1 is between 12:00:00 and 12:59:59 I want to write 'hello' into another cell: A4 of sheet2

How does it work?

Thanks in advance
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Sorry guys but i wrote 'hello' because I though would be easier...but it starts to complicate my point of view.
that work perfect:
=IF(AND(Sheet1!A2>="12:20:00"*1,Sheet1!A2<="12:30:00"*1),"Hello","")
but instead writing hello and I want to copy a value of cell A1 of sheet1 into Cell A3 of sheet2 in that interval, can you tell me how using that way?
 
Upvote 0
There is something wrong.
Can you tell me what?

Dim LastR As Range
With ThisWorkbook
Set LastR = .Sheets("sheet2").Range("A1")
If Not IsEmpty(LastR) Then _
Set LastR = .Sheets("sheet2").Range("A" & Rows.Count).End(xlUp)(2)
LastR = IF(AND(Sheet1!A2>="15:37:00"*1,Sheet1!A2<="15:38:00"*1),"Hello","")
End With
I did that so it will start to fill my values from A1 otherwise it started from A2
but the error is
LastR = IF(AND(Sheet1!A2>="15:37:00"*1,Sheet1!A2<="15:38:00"*1),"Hello","")
 
Upvote 0
Are you trying to put that formula in the cell with VBA Code?

LastR.Formula = "=IF(AND(Sheet1!A2>=""15:37:00""*1,Sheet1!A2<=""15:38:00""*1),""Hello"","""")"
 
Upvote 0

Forum statistics

Threads
1,214,391
Messages
6,119,239
Members
448,879
Latest member
VanGirl

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