+ Reply to Thread
Results 1 to 1 of 1

How to write VBA Code to copy Row data based on date criteria and condition

  1. #1
    Registered User
    Join Date
    06-18-2014
    Location
    Canada
    MS-Off Ver
    2010, 2013
    Posts
    1

    Exclamation How to write VBA Code to copy Row data based on date criteria and condition

    Hello Team,

    I need your help here with VBA code to run macro when click the button.
    Much appreciated if you can assist me again.

    Since I'm new to VBA, I am unable to execute this code in the row I want it to run in, but I would like to run it for the next two rows as well, but I don't know how to apply logic to go to the next row. As I want to copy data three times for the same date. Below is the code that generates upon clicking the button.

    Private Sub CommandButton1_Click()

    Dim Rg As Range, copyRange As Range

    Set Rg = Nothing

    Set Rg = Me.UsedRange.Columns(1).Find(Application.Text(Date, [A16].NumberFormat), [A18], xlValues)

    If Rg Is Nothing Then
    MsgBox "Today's Date Not Found. Please check the 'Date Received'"
    Else
    Set copyRange = [B16:W16]
    Rg.Offset(0, 1).Resize(1, copyRange.Columns.Count).Value2 = [B16:W16].Value2

    End If

    End Sub


    I need to update data reading three times a day, Like morning, afternoon and evening.
    so, I want to copy my reading data from the row where I am updating three times a day upon the button click “Copy today's data to the respective date. See the attached file herewith for more details

    I hope I am able to explain my query as I am not a tech person but trying my best.

    PS: info, i have post same question on Chandoo.org as well.

    Thank you for your help.
    Attached Files Attached Files
    Last edited by doit_2729; 12-05-2021 at 04:10 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VB Code to copy and paste data based on Criteria
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 08-17-2020, 07:29 AM
  2. [SOLVED] Copy some cell data and write new data based on criteria in a row
    By snowfish in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-03-2020, 09:32 PM
  3. [SOLVED] Vba code to filter and copy data based on criteria.
    By sapnawat in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-08-2018, 02:11 AM
  4. [SOLVED] Copy data to master wb based on date criteria.
    By beenbee in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-10-2014, 10:44 AM
  5. Replies: 2
    Last Post: 10-06-2013, 02:03 PM
  6. VBA code not working for copy and pasting data based on criteria.
    By harkin123 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-16-2013, 04:55 AM
  7. [SOLVED] How Do I Write a Macro for Highlighting Rows Based on Date Criteria
    By TMack in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-21-2013, 11:15 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1