Results 1 to 3 of 3
Hybrid View
-
15th Dec 2011, 06:01 AM #1OPMemberWebsite's:
facebook.comfigured it out, tought i would share it...
Code:Option Explicit Sub TransferData() Dim wkb As Workbook, wks As Worksheet, LastRow As Long Dim FilePath As String, FileName As String Dim ws As Worksheet, blnOpened As Boolean FilePath = "C:\test" 'change path here FileName = "Book2.xls" 'change name here Call ToggleEvents(False) Set ws = ThisWorkbook.Sheets("Sheet1") 'source sheet If WbOpen(FileName) = True Then Set wkb = Workbooks(FileName) blnOpened = False Else If Right(FilePath, 1) <> Application.PathSeparator Then FilePath = FilePath & Application.PathSeparator End If Set wkb = Workbooks.Open(FilePath & FileName) blnOpened = True End If Set wks = wkb.Sheets("Sheet1") 'destination sheet name LastRow = wks.Cells.Find(what:="*", after:=wks.Cells(1, 1), searchorder:=xlByRows, searchdirection:=xlPrevious).Row + 1 wks.Cells(LastRow, "A").Value = ws.Cells(1, "B").Value wks.Cells(LastRow, "B").Value = ws.Cells(4, "B").Value wks.Cells(LastRow, "C").Value = ws.Cells(7, "B").Value wks.Cells(LastRow, "D").Value = ws.Cells(7, "E").Value If blnOpened = True Then wkb.Close SaveChanges:=True End If If MsgBox("Clear values?", vbYesNo, "CLEAR?") = vbYes Then Call ClearData End If Call ToggleEvents(True) End Sub Sub ClearData() Dim ws As Worksheet Set ws = ThisWorkbook.Sheets("Sheet1") ws.Range("B1").ClearContents 'Name ws.Range("B4").ClearContents 'Address ws.Range("B7").ClearContents 'Age ws.Range("E7").ClearContents 'Sex End Sub Sub ToggleEvents(blnState As Boolean) With Application .DisplayAlerts = blnState .EnableEvents = blnState .ScreenUpdating = blnState If blnState Then .CutCopyMode = False If blnState Then .StatusBar = False End With End Sub Function WbOpen(wbName As String) As Boolean On Error Resume Next WbOpen = Len(Workbooks(wbName).Name) End Function
cotufa-ssdd Reviewed by cotufa-ssdd on . VBA: Add Specific Cell Values to Table in Existing Workbook?? (HELP) Hey guyz, I am having a little trouble and would like some help. I have a template worksheet in excel with payroll information. This template is used for all employees. Now I want to create a button that copies certain cell values (Name, date, total, etc) and adds them to a table in a separate existing workbook. In other words it would be a summary of the payroll. Rating: 5All right everyone, line up alphabetically according to your height.
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Not Existing link redirect to Main URL
By Rizwan Saleem in forum WordpressReplies: 1Last Post: 8th Nov 2011, 01:32 PM -
Search Mod for Existing Topic?!
By Deadmau5 in forum vBulletinReplies: 6Last Post: 10th Aug 2011, 08:29 PM -
google crawler poting values on my site WTF ?
By cgworld in forum Webmaster DiscussionReplies: 27Last Post: 4th Jan 2011, 12:52 AM -
[Help] Javascript for coping values to clipboard ?
By Snell in forum Web Development AreaReplies: 4Last Post: 16th Nov 2010, 09:30 AM -
Installing dle on existing databse
By janu123 in forum Webmaster DiscussionReplies: 18Last Post: 8th Oct 2010, 06:08 AM
themaLeecher - leech and manage...
Version 5.03 released. Open older version (or...