Results 1 to 20 of 20

After copying cells to another workbook the contents does not show up as expected.

Threaded View

  1. #1
    Registered User
    Join Date
    10-07-2013
    Location
    Tulsa, Oklahoma
    MS-Off Ver
    Excel 2003
    Posts
    12

    After copying cells to another workbook the contents does not show up as expected.

    Sorry I am new to VBA.
    I have a test that runs on a device. The results of the test are written to an excel spreadsheet. Each device tested has its own workbook. The sheet from the needed data is opened then the macro is ran by selecting the button. My problem is that my code opens the file I choose, MLTEST, but it does not copy the contents of the file. Instead it copies what is in the quotes from the Macro that I ran and saved. I have changed the macro to include srtFN instead of the original file name.
    To help I have 3 files that have information in them so I can test my macro by using the button. The button allows me to choose the file I want to add to the list. The macro writes to file MLTEST(G,17) if it is empty. It keeps searching until a cell in row 17 is empty.
    What do I need to do to my code to get the contents into the new location? I know this is simple but I have tried to add a .value to multiple places including after the strFN. If I keep the original filename in the part of the macro that I ran and saved it works except that I cannot choose the file. It keeps filling in the data with the same file. I have tried this using the Absolute method and the relative method of recording.
    Following is my code:
    Sub SendData()
    '
    ' SendData Macro
    ' Macro recorded 10/9/2013 
    '
    '   The following opens a file of your choice
    
        Dim strFN As String
        strFN = Application.GetOpenFilename
        If strFN = "False" Then
         Exit Sub
        Else: Workbooks.Open Filename:=strFN
        MsgBox strFN
        End If
        
    '    If Range("G17") = "" Then
    '        Range("G17").Activate
    '    Else
    '        Range("G17").End(xlToRight).Offset(0, 1).Select
    '        If ActiveCell.Value = "" Then
        Range("G17").Activate
        Do Until IsEmpty(ActiveCell.Value)
            ActiveCell.Offset(0, 1).Activate
        Loop
            
        
        Workbooks.Open Filename:=strFN
        ActiveCell.Offset(0, 0).Range("A1").Select
        ActiveCell.FormulaR1C1 = "strFN!SerialNumber"
        ActiveCell.Offset(2, 0).Range("A1").Select
        ActiveCell.FormulaR1C1 = "strFN!FrictionAvg"
        ActiveCell.Offset(1, 0).Range("A1").Select
        ActiveCell.FormulaR1C1 = "strFN!FrictionStDev"
        ActiveCell.Offset(1, 0).Range("A1").Select
        ActiveCell.FormulaR1C1 = "strFN!FrictionTorqueMin"
        ActiveCell.Offset(1, 0).Range("A1").Select
        ActiveCell.FormulaR1C1 = "strFN!FrictionTorqueMax"
        ActiveCell.Offset(1, 0).Range("A1").Select
        ActiveCell.FormulaR1C1 = "strFN!SpringAvg"
        ActiveCell.Offset(1, 0).Range("A1").Select
        ActiveCell.FormulaR1C1 = "strFN!SpringStDev"
        ActiveCell.Offset(1, 0).Range("A1").Select
        ActiveCell.FormulaR1C1 = "strFN!SpringTorqueMin"
        ActiveCell.Offset(1, 0).Range("A1").Select
        ActiveCell.FormulaR1C1 = "strFN!SpringTorqueMax"
        ActiveCell.Offset(-9, 1).Range("A1").Select
       
        
    End Sub
    Any help would be appreciated. Thanks to all. Again I am new to VBA and using Forums.
    Sorry I forgot to put down that I was using Excel 2003.
    Attached Files Attached Files
    Last edited by msmith1955; 10-10-2013 at 02:43 PM. Reason: Left out that I was using Excel 2003

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 7
    Last Post: 06-11-2012, 07:41 AM
  2. Dropdown menu and Autofill
    By neilq5 in forum Excel General
    Replies: 1
    Last Post: 06-11-2012, 06:24 AM
  3. Show contents of vertical cells in horizontal cells
    By malnahar in forum Excel General
    Replies: 4
    Last Post: 11-23-2008, 03:43 PM
  4. Forcing merged cells to expand to show all contents
    By Glio in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-05-2008, 06:19 AM
  5. Show the contents of certain cells if....
    By irresistible007 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-05-2005, 09:05 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