Solved

VBA Code

Posted on 2014-07-28
7
226 Views
Last Modified: 2014-07-31
Hi Experts,

Will anyone help me with piece of code which execute “Copy Trigger data” Module in attached WB.
If below Condition Match.
If time is between 9:40 to 15:30 & Column L <>”” & Column M<>”Posted”
Range for looping = L2: L1699 & M2:M1699
Flow like this if say L2<>”” i.e. in attached it is “Testing” & M2 <>”Posted” & time is between 9:40 – 15:30
Then Execute Module “Copy Trigger Data”
         Put “Posted” in Cell M2.
If above AND condition doesn't match then exit.
Code run on real time basis.

Thanks
EE-Demo.xlsm
0
Comment
Question by:itjockey
  • 4
  • 3
7 Comments
 
LVL 21

Accepted Solution

by:
Ejgil Hedegaard earned 500 total points
ID: 40225141
Use the function Timevalue to check for time.

To match the conditions, replace
If c.Value <> "" Then

Open in new window

with
If c.Value <> "" And TimeValue(Now()) >= TimeValue("09:40:00") And TimeValue(Now()) <= TimeValue("15:30:00") And c.Offset(0, 1) <> "Posted" Then
            c.Offset(0, 1) = "Posted"

Open in new window

0
 
LVL 8

Author Comment

by:itjockey
ID: 40225509
May i have Sample WB please!!!
0
 
LVL 8

Author Comment

by:itjockey
ID: 40226076
Mr.Ejgil Hedegaard,

Did what you said - this is the error messageError Message
Thanks
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 21

Expert Comment

by:Ejgil Hedegaard
ID: 40227585
Here is the WB.
EE-Demo-A.xlsm
0
 
LVL 8

Author Comment

by:itjockey
ID: 40227898
Perfect - Just need to confirm this Code will run on real time basis without human intervention? as row 2 to 1699 data updated on real time basis & column L have referencing formula to these real time data as and when condition match, column L produce some string else it will "". i guess you got my point.


Thanks
0
 
LVL 21

Expert Comment

by:Ejgil Hedegaard
ID: 40229565
The conditions for the row processed (2 to 1699) are
- The cell in column L must have a value, anything will do
- The cell in column M must not have the text "Posted"
- The real time (Now) is between 9:40 and 15:30
Then the text "Posted" is put in the cell in column M

And the rest of the code add values and formulas to the first empty row below 1700 for the processed row.
Did not check what, just that it happens.
0
 
LVL 8

Author Closing Comment

by:itjockey
ID: 40231145
Yes it is happen ...I thought for Real time I have to ask new question .....Thank You Very Much
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Excel Formula 16 48
Data Copy 4 29
Powerpoint 2013: Change cell reference in excel link 3 39
VBA to add shapes inside a chart 9 22
Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question