Copying and autoupdating information from a master sheet to secondary sheets

05Li139

New Member
Joined
Nov 10, 2016
Messages
8
Hi Everyone,

I've included a cleaned version of the workbook I will be using (the native file includes commercially sensitive information) that is identical in layout and structure to the native workbook.

I'm trying to set up a workbook that copies information from ['Raw_Data' columns B, D, E, H, I, J, P, R, S] to a new worksheet generated based on the 'Template' tab of the same workbook.

I've created a form inside 'Worksheet_Update_Tab' that pulls up information from ['Reference_Categories' columns B, C, D], with the idea that at the end of the form there will be a button that pulls all of the rows from the 'Raw_Data' Tab that have a cell matching the concatenated value in column D. It will then assign those to a reporting week as identified in the form, and paste the newly updated values for each week into a sheet generated named after the value in ['Worksheet_Update_Tab', D4]. If a worksheet already exists with this title, the information for the new reporting week should be pasted below the values generated the week earlier.

This is to allow dashboards to be built and trend analysis to take place.

I've previously used this code in another workbook to copy data and associated values from one form into another new/existing worksheet, however the ranges that this was looking at were limited to one worksheet; can this be modified to achieve what I'd like to?


Thank you for the help.




Code:
[
Sub UpdateLogWorksheet()
    Dim historyWks As Worksheet
    Dim inputWks As Worksheet
    Dim nextRow As Long
    Dim oCol As Long
    Dim myRng As Range
    Dim myCopy As String
    Dim myCell As Range
    
    
    myCopy = ("F3:F7, J12:J25")
    Set inputWks = Worksheets("Input")
    Set historyWks = Worksheets("OutputAll")
    With historyWks
        nextRow = .Cells(.Rows.Count, "B").End(xlUp).Offset(1, 0).Row
    End With
    With inputWks
        Set myRng = .Range(myCopy)
    End With
    With historyWks
        With .Cells(nextRow, "A")
            .Value = Now
            .NumberFormat = "mm/dd/yyyy hh:mm:ss"
        End With
        .Cells(nextRow, "B").Value = Application.UserName
        oCol = 3
        For Each myCell In myRng.Cells
            historyWks.Cells(nextRow, oCol).Value = myCell.Value
            oCol = oCol + 1
        Next myCell
    End With
      
      With inputWks
      On Error Resume Next
         With .Range(myCopy).Cells.SpecialCells(xlCellTypeConstants)
              .ClearContents
              Application.GoTo .Cells(1)
         End With
      On Error GoTo 0
    End With
End Sub
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

Forum statistics

Threads
1,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

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