Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all
I have created a master spreadsheet which I have written a code for in order to: 1. Delete all contents except the first row, which I have written as : Sheets("Data").Select Rows("2:2").Select Range(Selection, Selection.End(xlDown)).Select Selection.ClearContents Range("a2").Select 2. It will look at the file path and file name (as the original files are saved in the same foler on a monthly basis), and then select and copy all the data within the specified file path and paste it onto my master spreadsheet, which looks like this: qpath = [D14].Value: qfile = [D15].Value 'Opening workbook specified within the worksheet and copy all data Workbooks.Open(qpath & qfile).Activate Sheets("Sheet1").Select Rows("2:2").Select Range(Selection, Selection.End(xlDown)).Select Selection.Copy Windows("Corporate File Preparation").Activate Sheets("Data").Select Range("2:2").Select Range(Selection, Selection.End(xlDown)).Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False Windows(qfile).Activate Range("A2").Select ActiveWorkbook.Save ActiveWorkbook.Close Windows("Corporate File Preparation").Activate Sheets("Control").Select Range("B2").Select Eventually I have inserted a few columns at the end of the data for date stamp and other forumlas as well. However, my problem arises when I copy this module into other master spreadsheets, the formats and data are all different between them so what I did was to change the file paths and some of the formulas. Everything works perfectly, except when I link these master spreadsheets to Access, which is 8 in total, 7 of them are incorrect, due to the original module I written for consists of 27 columns (included 3 columns i have added in using vba) and 853 rows of data. The other spreadsheets have less columns and less rows of data, excel looks fine, but in Access, many blank rows and columns are also imported up to 27 columns and 853 rows. I am not sure what I need to do here as I will have to append these sets of data to another table in Access, it also append those are blank too. I think it's because my vba are written incorretly in Excel, or is it something to do with linking the tables in Access? Please help as I am very stuck here!!! Thanks a lot any help will be appreciated!!! Regards Vivian |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
what is the wrong? | Excel Worksheet Functions | |||
Insert Calculated Field (wrong Qty*Price = wrong Amount) | Excel Discussion (Misc queries) | |||
What is going wrong here... | Excel Programming | |||
what am i doing wrong | Excel Programming | |||
Where am I going wrong? | Excel Discussion (Misc queries) |