Sync 2 Excel files with Microsoft Visual Basic

Sise

New Member
Joined
Apr 8, 2013
Messages
2
Hello everybody,

I hope you will be able to help in my task, it is an easy one I guess. I am not familiar with Microsoft Visual Basic. But I have some knowledge in C.

This is what I would like to do:

I have 2 excel files, File 1 and File 2.
File 1 contains different arrays sort by board type ( array #1 => Board type 1, array #2 => Board type 2 ...), all these arrays are just under each others. (each array contains: number, board type, issue , ...). And File 2 is just an other file which contains only one Board_type.

Something like that:

File 1
Issue number: |Board type: | Issue: | ...

1.1.1 | Board_type_1 | power issue |
1.1.2 | Board_type_1 | mechanical issue |

1.1.1 | Board_type_2 | power issue |
1.1.2 | Board_type_2 | mechanical issue |

File 2 (number 1)
Issue number: |Board type: | Issue: | ...

1.1.1 | Board_type_1 | power issue |
1.1.2 | Board_type_1 | mechanical issue |

File 2 (number 2)
Issue number: |Board type: | Issue: | ...

1.1.1 | Board_type_2 | power issue |
1.1.2 | Board_type_2 | mechanical issue |

So what I would like to do is create, first, one button in the File 2 called "update" like that when I will modify file 2 it will update file 1.

That's my goal, but like I said I am not very familiar of Microsoft Visual Basic so if anybody can help me, It will be great.

Thanks,

Sise
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
allright, So I tried to learn a little bit more about Microsoft visual Basic. And this is my code:

Private Sub CommandButton1_Click()
Issue_Board_06_040313_FP_TEST = ThisWorkbook.Name

sourcefile = "Issue_Board_06_040313_FP_TEST.xls"
destinationfile = "Issue_Board_by_Type_040313_FP_TEST.xls"

'Select my windows
Windows(sourcefile).Activate
'Choose my criteria
criteria = "06"
'filter by my criteria
Range("A1").AutoFilter Field:=3, Criteria1:="criteria"
'try to select my selection but i do not know if this could work
Selection.AutoFilter Field:=3, Criteria1:="criteria"
'Copy this selection
Selection1.Copy

'Change to the destinationfile
Windows(destinationfile).Activate
Range("A1").AutoFilter Field:=3, Criteria1:="criteria"
Selection.AutoFilter Field:=3, Criteria1:="criteria"
'then i would like to paste selection1 in selection
Selection1.Paste.Selection
End Sub

I got the Run-time error '424' Object required for the line : Selection1.Copy.
I may be in the wrong way if anybody can tell me what is wrong. I would appreciate.

Thanks,

Sise
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,053
Latest member
Mesh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top