Click here to Skip to main content
15,920,633 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: click one treenode but it didn't response ,why Pin
sanyexian12-Jul-10 5:06
sanyexian12-Jul-10 5:06 
AnswerRe: click one treenode but it didn't response ,why Pin
Аslam Iqbal12-Jul-10 11:54
professionalАslam Iqbal12-Jul-10 11:54 
GeneralRe: click one treenode but it didn't response ,why Pin
sanyexian12-Jul-10 20:50
sanyexian12-Jul-10 20:50 
QuestionCopy data from one excel file to another excel file Pin
priyaahh12-Jul-10 0:49
priyaahh12-Jul-10 0:49 
AnswerRe: Copy data from one excel file to another excel file Pin
Syed Wayez Ahmed12-Jul-10 2:49
Syed Wayez Ahmed12-Jul-10 2:49 
GeneralRe: Copy data from one excel file to another excel file Pin
Syed Wayez Ahmed12-Jul-10 3:13
Syed Wayez Ahmed12-Jul-10 3:13 
GeneralRe: Copy data from one excel file to another excel file Pin
priyaahh12-Jul-10 5:22
priyaahh12-Jul-10 5:22 
AnswerRe: Copy data from one excel file to another excel file Pin
Sonhospa12-Jul-10 11:58
Sonhospa12-Jul-10 11:58 
Hi,

it's quite simple as long as the columns of both workbooks are consistent, i.e. if the first column of Workbook1.WorkSheet1 has to go to the first column of Workbook2.Worksheet1, etc. The following snippet works and can give you a first idea:
Sub CopyToTarget()
    Dim tgt As Excel.Workbook
    Dim target As String
    Dim rng As Range
    
    ' define the range to copy here
    ' with End(xlDown) you catch all the rows as long as there are no empty cells.
    Set rng = ActiveSheet.Range(Cells(2, 1), Cells(2, 1).End(xlDown))
    
    ' open the target workbook as object; in this case the workbook has to exist already!
    Set tgt = Application.Workbooks.Open("D:\Target.xls")
    
    ' copy the range to the required cell
    rng.Copy tgt.Worksheets("Tabelle1").Cells(2, 1)
    
    ' save and close the target workbook
    tgt.Save
    tgt.Close
    
    ' delete objects that are no longer needed
    Set rng = Nothing
    Set tgt = Nothing
End Sub
If you have to identify the right column first, use the ranges method 'find' to determine the cell where you want to copy the data. In VBA, you will want to use IntelliSense as much as you can - it really helps you to find your way!

Thumbs Up | :thumbsup:
GeneralRe: Copy data from one excel file to another excel file Pin
priyaahh12-Jul-10 18:32
priyaahh12-Jul-10 18:32 
GeneralRe: Copy data from one excel file to another excel file Pin
Syed Wayez Ahmed12-Jul-10 21:18
Syed Wayez Ahmed12-Jul-10 21:18 
AnswerRe: Copy data from one excel file to another excel file Pin
Sonhospa12-Jul-10 22:36
Sonhospa12-Jul-10 22:36 
AnswerRe: Copy data from one excel file to another excel file Pin
Sonhospa13-Jul-10 7:08
Sonhospa13-Jul-10 7:08 
GeneralRe: Copy data from one excel file to another excel file Pin
priyaahh13-Jul-10 7:17
priyaahh13-Jul-10 7:17 
GeneralRe: Copy data from one excel file to another excel file Pin
Sonhospa13-Jul-10 9:20
Sonhospa13-Jul-10 9:20 
Questionretrieve the salt from a mysql database for a password. [modified] Pin
malcomhfc11-Jul-10 9:09
malcomhfc11-Jul-10 9:09 
AnswerRe: retrieve the salt from a mysql database for a password. Pin
DaveAuld11-Jul-10 9:41
professionalDaveAuld11-Jul-10 9:41 
GeneralRe: retrieve the salt from a mysql database for a password. Pin
malcomhfc11-Jul-10 9:55
malcomhfc11-Jul-10 9:55 
GeneralRe: retrieve the salt from a mysql database for a password. Pin
malcomhfc11-Jul-10 10:10
malcomhfc11-Jul-10 10:10 
GeneralRe: retrieve the salt from a mysql database for a password. Pin
DaveAuld11-Jul-10 10:37
professionalDaveAuld11-Jul-10 10:37 
GeneralRe: retrieve the salt from a mysql database for a password. Pin
malcomhfc11-Jul-10 11:39
malcomhfc11-Jul-10 11:39 
GeneralRe: retrieve the salt from a mysql database for a password. Pin
DaveAuld11-Jul-10 12:28
professionalDaveAuld11-Jul-10 12:28 
GeneralRe: retrieve the salt from a mysql database for a password. Pin
malcomhfc11-Jul-10 12:50
malcomhfc11-Jul-10 12:50 
GeneralRe: retrieve the salt from a mysql database for a password. [modified] Pin
DaveAuld11-Jul-10 13:00
professionalDaveAuld11-Jul-10 13:00 
GeneralRe: retrieve the salt from a mysql database for a password. Pin
Luc Pattyn11-Jul-10 13:42
sitebuilderLuc Pattyn11-Jul-10 13:42 
GeneralRe: retrieve the salt from a mysql database for a password. Pin
DaveAuld13-Jul-10 7:57
professionalDaveAuld13-Jul-10 7:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.