Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


VBA Code

Posted on 2014-07-28
Medium Priority
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.

Question by:Naresh Patel
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 23

Accepted Solution

Ejgil Hedegaard earned 2000 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

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


Author Comment

by:Naresh Patel
ID: 40225509
May i have Sample WB please!!!

Author Comment

by:Naresh Patel
ID: 40226076
Mr.Ejgil Hedegaard,

Did what you said - this is the error messageError Message
Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

LVL 23

Expert Comment

by:Ejgil Hedegaard
ID: 40227585
Here is the WB.

Author Comment

by:Naresh Patel
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.

LVL 23

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.

Author Closing Comment

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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

688 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