Results 1 to 2 of 2

Pulling cell contents from a different sheet / adding a static number to export from cell

Threaded View

jayinthe813 Pulling cell contents from a... 08-28-2012, 11:52 AM
jayinthe813 Re: Pulling cell contents... 08-28-2012, 08:55 PM
  1. #1
    Forum Contributor
    Join Date
    08-01-2012
    Location
    Tampa
    MS-Off Ver
    Excel 2010
    Posts
    121

    Pulling cell contents from a different sheet / adding a static number to export from cell

    Here is the code I am running, and I now have a few (albeit, simple) problems. The code that I highlighted in red, will take the value from sheet1 where as I need to take it from sheet2, (sheet 2, cell B21 to be specific, not sure how to change the range without using activesheet).


    Sub EXPORT()
    
    Dim wb As Workbook
    Dim ws As Worksheet
    
        Set wb = Workbooks.Open(Filename:= _
            "DailyTotalCount.xls")
        Set ws = wb.Worksheets(1)
        With ws
        
            nextrow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
        End With
        
            With Workbooks(2).ActiveSheet
     
            ws.Cells(nextrow, "A") = Format(Date, "dd-mmm")
            
            .Range("B21").Copy ws.Cells(nextrow, "B")      
            
            ws.Cells(nextrow, "C").Value = 1014
    
        End With
        
        wb.Save
        wb.Close
        
        Set ws = Nothing
        Set wb = Nothing
    
    End Sub
    I was able to copy the cell by doing
    Worksheets("Sheet2").Range("B21").Copy ws.Cells(nextrow, "B")
    but it copied the formula rather than value...
    Last edited by jayinthe813; 08-28-2012 at 08:51 PM.

Thread Information

Users Browsing this Thread

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

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