+ Reply to Thread
Results 1 to 2 of 2

Pasting merged cell values into one row which corresponds to today's date

  1. #1
    Registered User
    Join Date
    01-15-2019
    Location
    Scotland
    MS-Off Ver
    Microsoft for 365
    Posts
    1

    Pasting merged cell values into one row which corresponds to today's date

    Hi all,

    I'm fairly new to VBA. I have a sheet for a daily report ("PlatformReport") which gets overridden with new information each day. I've created a userform button to copy and paste this information into a new sheet within the workbook. So far with my code I am able to copy a defined range and merge these cells ( there often may be varying numbers of rows within each defined range) and I am able to then paste this into a new worksheet in the next available row.

    However, instead of pasting to the next available row, I have a date column in column A in this worksheet ("OIMSummary") and have been trying to find a piece of code which will paste the merged cells in the range into the corresponding row which matches today's date. I've found a piece of code which does paste in the row next to todays date, but its doesn't paste the merged cells, it pastes all rows.


    Here's the piece of code which pastes the merged cells into the next available row:

    Worksheets("PlatformReport").Range("OIM").Copy

    Worksheets("OIMSummary").Activate
    b = Worksheets("OIMSummary").Range("B" & Rows.count).End(xlUp).Offset(1).Select
    ActiveSheet.Paste

    Dim MyCell As Range
    Dim strMerge(1 To 2) As Variant


    Dim i As Integer

    For i = 1 To 2

    For Each MyCell In Sheets("PlatformReport").Range("LAPlyerNo")

    If strMerge(i) = "" Then
    strMerge(i) = MyCell.Value
    Else
    strMerge(i) = strMerge(i) & " " & MyCell.Value
    End If

    Next MyCell

    If finalStr = "" Then
    finalStr = strMerge(i)
    Else
    finalStr = finalStr & Chr(10)
    End If

    Next
    Worksheets("OIMSummary").Activate

    Worksheets("OIMSummary").Range("C" & Rows.count).End(xlUp).Offset(1).Value = finalStr

    Any help would be greatly appreciated.

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Pasting merged cell values into one row which corresponds to today's date

    Use the find method to locate the date row.
    Please Login or Register  to view this content.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

+ 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] Return different values in a cell from different column ranges, based on today`s date
    By schmidta1988 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-03-2016, 07:07 AM
  2. Replies: 5
    Last Post: 01-02-2016, 10:51 AM
  3. Copy Data of today's date from cell and pasting it into another workbook
    By sachit08 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-16-2015, 06:45 PM
  4. Macro for pasting text into a merged cell?
    By Robbosan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-02-2015, 08:33 AM
  5. [SOLVED] Count cell values under column with today's date header
    By jben86 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 09-23-2013, 03:19 PM
  6. Store values that corresponds to each date
    By siddiq1212 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-18-2013, 05:33 PM
  7. [SOLVED] Pasting text into merged cell
    By GeorgeB in forum Excel General
    Replies: 1
    Last Post: 05-17-2005, 12:06 PM

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