+ Reply to Thread
Results 1 to 3 of 3

Copying table from input data into database - keep same reference number for range table

Hybrid View

nrizzatti Copying table from input data... 08-27-2014, 01:10 PM
nrizzatti Re: Copying table from input... 08-27-2014, 03:12 PM
nrizzatti Re: Copying table from input... 08-27-2014, 03:13 PM
  1. #1
    Registered User
    Join Date
    08-27-2014
    Location
    Berkeley
    MS-Off Ver
    2010
    Posts
    3

    Copying table from input data into database - keep same reference number for range table

    Hi,

    Can someone help me with my code. File attached. I was trying to modify an existing code I have to make it to work and could not figure out. The old code is below. Main difference is that on this current file I need the code to copy the entire table (table name - panelbundle) instead of specific cells.

    Code is in module 1 - loginventory in the attached file
    Module 2 I made it to work just fine.

    Put a quick explanation in the Log Inventory tab to clarify what I'm trying to do.

    I appreciate much any help. Kind regards, Natalia


    Old code I was trying to modify is as follows:

    Sub UpdateLogWorksheet()

    Dim historyWks As Worksheet
    Dim inputWks As Worksheet

    Dim nextRow As Long
    Dim previousRow As Long
    Dim oCol As Long

    Dim myRng As Range
    Dim myCopy As String
    Dim myCell As Range
    Dim coatercoil As Integer
    Dim coaterlocation As String

    'cells to copy from Input sheet - some contain formulas
    myCopy = "b2,b4,b10,b12,b14,b16,b8,e10,e12,e14,e16,b20,e20,h20,b18"



    Set inputWks = Worksheets("Received Coil Input")
    Set historyWks = Worksheets("Bare Log")

    coatercoil = inputWks.Cells(22, 2).Value
    coaterlocation = inputWks.Cells(24, 2).Value


    With historyWks
    nextRow = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0).Row
    previousRow = nextRow - 1
    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

    'clear input cells that contain constants
    With inputWks
    On Error Resume Next
    With .Range(myCopy).Cells.SpecialCells(xlCellTypeConstants)
    .ClearContents
    Application.GoTo .Cells(1) ', Scroll:=True
    End With
    On Error GoTo 0
    End With

    historyWks.Cells(nextRow, 15).FormulaR1C1 = historyWks.Cells(previousRow, 15).FormulaR1C1
    historyWks.Cells(nextRow, 18).FormulaR1C1 = historyWks.Cells(previousRow, 18).FormulaR1C1


    historyWks.Cells(nextRow, 23).Value = coatercoil
    historyWks.Cells(nextRow, 24).Value = coaterlocation

    inputWks.Cells(22, 2).ClearContents
    inputWks.Cells(24, 2).ClearContents

    End Sub
    Attached Files Attached Files
    Last edited by nrizzatti; 08-27-2014 at 04:57 PM.

  2. #2
    Registered User
    Join Date
    08-27-2014
    Location
    Berkeley
    MS-Off Ver
    2010
    Posts
    3

    Re: Copying table from input data into database - keep same reference number for range tab

    I'm trying to solve this and issue this new format prior to month end where we'll have to log all the bundles. I really appreciate any tip towards my code issue.

    Thank you so much in advance.

    Kind Regards,

    Natalia

  3. #3
    Registered User
    Join Date
    08-27-2014
    Location
    Berkeley
    MS-Off Ver
    2010
    Posts
    3

    Re: Copying table from input data into database - keep same reference number for range tab

    I'm trying to solve this and issue this new format prior to month end where we'll have to log all the bundles. I really appreciate any tip towards my code issue.

    Thank you so much in advance.

    Kind Regards,

    Natalia

+ 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] Input cell reference is not valid (One Variable Data Table)
    By Dottore in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 PM
  2. [SOLVED] Input cell reference is not valid (One Variable Data Table)
    By Dottore in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 11:05 AM
  3. Input cell reference is not valid (One Variable Data Table)
    By Dottore in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM
  4. [SOLVED] Input cell reference is not valid (One Variable Data Table)
    By Dottore in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  5. VBA Code for a pivot table to open database and to reference table current page
    By Pete Straman Straman via OfficeKB.com in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-21-2005, 12:06 AM

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