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 can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
with this,
LastR.FormulaR1C1 = "=IF(AND(Sheet1!r2c1>=""15:37<wbr>:00""*1,Sheet1!r2c1<=""15:38<wbr>:00""*1),Sheet1!r2c2,"""")"


I copy into LastR the formula of Sheet1!r2c2

What if I want to copy just the value and not the formula?
 
Upvote 0
Try this..

Code:
With LastR
    .FormulaR1C1 = "=IF(AND(Sheet1!r2c1>=""15:37<WBR>:00""*1,Sheet1!r2c1<=""15:38<WBR>:00""*1),Sheet1!r2c2,"""")"
    .Value = .Value
End With
 
Upvote 0
Worked for me...

I based that on your previous post #12
I fixed it with

Quote:
<TABLE cellSpacing=0 cellPadding=6 width="100%" border=0><TBODY><TR><TD class=alt2 style="BORDER-RIGHT: 1px inset; BORDER-TOP: 1px inset; BORDER-LEFT: 1px inset; BORDER-BOTTOM: 1px inset">LastR.FormulaR1C1 = "=IF(AND(Sheet1!r2c1>=""15:37:00""*1,Sheet1!r2c1<=""15:38:00""*1),""Hello"","""")" </TD></TR></TBODY></TABLE>

If that did indeed work, then my suggested solution should also work..
 
Upvote 0
is it possible to use the same method with a If statement?
Something like

IF(AND(Sheet1!r2c10>=""09:00:00""*1,Sheet1!r2c10<=""09:05:00""*1) then
....do something...

I don't really have any idea
 
Upvote 0
Why don't you ...

1. Show the code you currently have
2. Explain in FULL Detail what you want the code to do?


perhaps..
Code:
With Sheets("Sheet1").Range("A2")
    If.Value >= TimeSerial(21,0,0) AND .Value <= TimeSerial(21,5,0) Then
        Do Stuff
    End if
End With
 
Upvote 0

Forum statistics

Threads
1,215,197
Messages
6,123,585
Members
449,108
Latest member
rache47

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