Working With An Imported File
Mar 11, 2008I'm importing a file into Excel which I need to format into something I can then use to build reports from.
At present the imported file looks like this: ...
I'm importing a file into Excel which I need to format into something I can then use to build reports from.
At present the imported file looks like this: ...
Have the following code:
With iSheet
i = .Range("A" & Rows.Count).End(xlUp).Row
j = .Cells(1, Columns.Count).End(xlToLeft).Column
.Range("A1", .Cells(i, j)).ClearContents
[Code] .......
If I use F9 to pause the code before the sort part in blue, then the data imports into Excel from the database and then subsequently pressing F5 sorts the data as required.
However, if I run the macro in a single pass, the data does not sort. Why it's not sorting as expected and how to make it sort as required?
I recently had a virus on my computer and had to replace it. I had a ton of macros saved in my Personal.xlsb workbook, so I exported those modules and have now imported them to the new Personal.xlsb file. Now for some reason those macros no longer work in other files. Most of them are basic, like I have a macro to paste values or paste formats, etc. but I have some others that are very complex. The macros work fine as long as I am in Personal.xlsb, but if I try to use them in another open workbook I get the "all macros may be disabled or the macro may not be available in this workbook" message. I am using Excel 07 and have verified that macros are enabled.
View 3 Replies View RelatedIs there a property that contains the name of an XML file a user has imported into Excel? If not is there any way I can retrieve the name of the file?
View 4 Replies View RelatedI'm working on a sheet to analyse data in .CSV format, sofar I can import the .CSV file correctly, however I would like the Macro to name the sheet with same name as the .CSV file.
As i'll be importing multiple .CSV files.
The code I have sofar is:
How can I get from this:
Random Item name;random_nickname Final price: EUR 1.00 (Fixed price)
this:
EUR 1.00
I am trying to convert a text imported from CSV file to a number so that I can further elaborate it.
I tried value, trim, clean but without sucess.
Cell values is -10 000,00 what I want to display is 10000.
How can i Do that.
I am attaching a demo file for illustration : Webistexpences.xlsxi
I have attached two files, one the sample txt file imported to excel but the top area is highlighed with some notes and section break. RED deleted don't need amd un highlighted is actual data. The other file is what I would like to see the data look like after parse.
View 5 Replies View RelatedI need to clean out unnecessary data from a file, (see attached text file), I'm not sure how to go about this in excel. basically every file starts with 9 cells that needs to be deleted, two cells of real data then one with garbage that needs to be deleted, it goes like that for 40 cells, then again 10 cells of garbage that needs to be deleted, then 40 of real data and goes like that up to 3000 lines, I know it sounds confusing but if you take a look at attached file, at the end I need to have
all cells full of data
I need to bring in 2600 student names from a cvs file and have it formatted to an Excel workbook.
When it imports into the Excel file I need it to populate the proper boxes, such as:
StudentLastName
StudentFirstName
StudentID
GradeLevel
TeacherName
TeacherID
RoomNumber
I have the CVS attached. Hope I can get this done. As you can see it shows the teacher's name with their first initial, their teacher number that they are identified by and their room number. I need the student ID as well but not the phone number and the days of the week. This would save a lot of work.
I have a file with four sheets – File1, File2, Association and LookList. File1&2 are totalled, as is Association sheet but then are checked against each other using the totals. What I need to do is the following (but I am not sure how to do it using macro…)
Step 1 - ‘File1’ Sheet – It all comes in text format. Firstly, convert all of column B=>used range (it may vary to 40k records!) into numbers and total each column.
(I know the principal behind it – have a total variable for ColB, loop through and when it finds >0 then increment buy one and output under the last cell in that column – but I do not know the macro code)
Step 2 - ‘File2’ Sheet – Again, it's in text format. Firstly, convert all of column B=>used range into numbers and total each column(would contain same amount of records
as Step1!) .
Step 3 - ‘Association’ – same steps as for File 1 (again – same number of records).
Step 4 - THEN (and I have NO IDEA how to do this!...) I need to check the File1 & File2 against Association using the lookup and return the Serial number and the Association heading that does not match on a fourth sheet.
The problem is that – for example – Field-1 consists total of more than one column – contains 3 but could contain a total of up to 6 columns! - I understand excel formula ‘vlookup’ but am not sure how to do it when it is a combination of columns and even less when applying it to this! – In fact, for a macro I am not even sure what column format the lookup list should be!
I've created a spreadsheet which, on running a macro, imports data from a text file, formats it and then sums various parts of it giving me a subset of the large file as a range of data for a chart (a pie chart) on Sheet 2.
The problem begins when I delete the data in the worksheet in preparation for another import - the Pie chart just loses all the data and I have to manually reselect it in the chart each time.
Once deleted the chart is blank, but as soon as the data is imported, I get reference errors when I click on Sheet 2
I must be doing something wrong. You can delete data and repopulate it and the chart should pick up with the new data. If the cells it is referencing are empty, it is blank. Not so here.
Is it to do with importing the data? Or the formula for my chart data?
I have a number of large CSV files with approximately 1.9 million rows, (this is more then excel can bring in). I typically have to import/delimit the files when brining them into excel. However, when I try this I get the message not all data imported. I would like to be able to split the records in the csv file to multiple tabs in the excel woorkbook when doing the import/delimit but do not know how to accomplish this. The delimit of the data varies each time due to the nature of the data so doing a macro is more trouble to create each time. Currently I am having to open the csv file in notepad and split it up into multiple files then import each new file seperately.
View 4 Replies View RelatedI have a code in file A that opens several files (B,C,D&E), copies some data from them, then closes the files. That part of the code works fine, but each of the files that are opened (B,C,D,&E) have a Workbook Open event that causes the file to save automatically every 30 seconds. (I know this is not recommended, but this is what the user wants.) The files also have a Workbook Before Close event that is supposed to stop the timer so the file will close without reopening. These each run fine on their own.But if I run code A, the workbook Before Close event in file B (C,D, & E) does not seem to run and the files reopen after 30 seconds to save. When I step through the code it works fine and goes through the Before Close event in each file and the files remain closed.
View 3 Replies View RelatedI have a workbook that requires refreshed source data each day. The workbook has all of the macros and formulas that analyze the data. I have the following code to import the worksheet with the raw data (onto a fresh worksheet in the calculation workbook), but I would like to create code that also adds the date and time to the imported data worksheet -- not the date/time the raw data was created; instead, when it was imported into my calculation workbook.
Below is my code for importing the raw data worksheet:
[Code] .....
the small code i'm writing just needs to do the following:
1. open an .xslx file selected by the user
2. copy 2 worksheets from that file to the current one
3. close the selected file without saving it.
This is my code:
VB:
Sub GetData()
MsgBox ("Please select a file"), vbOKOnly
Master = Application.GetOpenFilename(FileFilter:="Excel Files (*.xlsx), *.xlsx", Title:="Please select a file")
[Code]....
Opening the file works, but the last 3 lines don't because i don't understand how to declare "Master": however i dim it (workbook, object, variant...) i get an error on the GetOpenFilename line. If i don't declare it, i get an error while trying to copy the worksheets.
I bought a new computer with Windows 7. A file that is fine on my old unit does not work on the new one.
Column "H" should provide a list of birthdays comming up in the next two months, but something is not working.
I have this code (not sure from which thread) which can export my worksheet with specific file name & folder (according to date and part type). I tried to put it in my worksheet but it's not working.
[Code]....
and it's highlighted at following part
[Code] ....
I received this error from the message box : Run-time error '1004'
Document not saved. The document may be open,or an error may have been encountered when saving.
application.FileSearch.NewSearch
application.FileSearch.LookIn = Workbooks(ActiveWorkbook.Name).Path
application.FileSearch.FileType = msoFileTypeAllFiles
application.FileSearch.SearchSubFolders = True
application.FileSearch.Filename = "Zone Selling*.xls"
application.FileSearch.MatchTextExactly = True
application.FileSearch.Execute
filecount = application.FileSearch.FoundFiles.Count
For i = 1 To filecount
Worksheets("Run").Cells(i, 1) = application.FileSearch.FoundFiles(i)
Next i
For i = 1 To filecount......................
But it won't list my files which is how the macro was running, it was returning a list of the files in the folder and then running them based on the path returned
I want to hide all toolbars and disable the red X upon opening of the spreadsheet, and to restore the main toolbars upon closing. That worked perfectly. (when I used the black code -see below)
I added in the red code as i wanted to disable the red X as well to ensure that users will always close the EXCEL worksheet via a Macro button.
The Macro will save the spreadsheet and close the worksheet and the Private sub should restore the toolbars.
I have some code that copies a worksheet and saves into a new workbook and saves into a specified folder and renames the new workbook.
It is all working fine however it is saving to my desktop and not the specified directory. I know there is a lot similar out there and i have exhausted my google skills trying to find the similar format to the one i am after.
Code:
Sub MonthlyReset()
Dim sourceSheet As String
Dim clearR As Range
Dim newFile As String
[Code]....
I have a list of about 300 addresses that I'd like to be able to put in a sortable state. In column A1-A4 is the following:
Name
Street Address
City, State Zip
Email Address
Then there is a blank row and then the next address. What I would like to do is figure out a way to take the info in columns A1-A4 and move them horizontally to A1, B1, C1, D1, respectively. Sure, I could cut and paste, but it would take me forever. I tried a macro,
I'm working on a sheet which references a sheet in another workbook. I want to refer to the other workbook simply by it's filename (Forecast.xls) but whenever I save and reopen Excel has replaced the filename with the full path (C:Documents and SettingskoconnorMy DocumentsAuto-sheet project[Forecast.xls])
This is quite inconvinient as I am eventually going to want to move both workbooks together to a different location. Is there a way to make Excel stop working out full file paths and just look for the filename in whichever folder the active sheet is sitting in?
I'm using Excel 2010. When I go into the Excel Options, to the Save option and try to type in a specific network drive in the Default File Location: box, I click OK and then it doesn't save the changes. I close Excel down all the way and then restart a new Excel session and it keeps going back to "LibrariesDocuments..."
It doesn't seem to be just related to Excel...having the same issue in Word and Access 2010 as well.
Despite setting the "Edit/Links/Startup Prompt/Don't display the alert and update links" option numerous times, my workbook still prompts me to update links every time I open it. The option seems to be set okay (it is preset whenever I go into the "Edit/Links/Startup Prompt" dialog), but it doesn't seem to affect the workbook's startup behaviour. The workbook contains a ComboBox control that is initialized with customer names from another workbook, which is included in the References for this main workbook.
I am using Excel 2003 (from Office Pro 2003) under Windows XP (SP1). I believe this used to work without the prompt when I was working on this app last fall (I'm not sure, as my memory of specific behaviours back that far is fuzzy). However, it has been persistently prompting ever since I started working on this app again this spring/summer. Was there perhaps a bad fix to Office 2003 (that I automatically applied) that broke this feature?
Imported contacts to appear in Autocomplete?
View 1 Replies View RelatedI am working with Microsoft Excel 2003. I am trying to import(or something
like it) from worksheet (A) to worksheet (B). Worksheet A is a spreadsheet
that I have saved to keep the same row names, etc. but the information within
the named cells is forever changing. I also save the information from
worksheet A, but have another copy that when I open, it always opens without
any changed data in it. MY question/problem is that I need to import the
data from A to B, and every time that A changes, I need B to automatically
update the data and continuously add to the spreadsheet I have made up for B.
I can NOT have A overwrite any data that I have already put into B.
I've imported a few thousand lines of data into excel, but some rows have a rogue character or a blank cell in the middle of them taking up a cell and shifting the rest of the row along one cell and putting it out of sync with the columns I want that data in.
Is there a way of remedying this without going through and manually moving a couple of hundred rows along one cell.
I'm not sure I've explained that particularly well, so I'll try and illustrate it with an example.
AAA 1.23 1.23 BBB 1.23 1.23 CCC 1.23 1.23
AAA 1.23 1.23 BBB 1.23 1.23 CCC 1.23 1.23
AAA 1.23 1.23 BBB ------ 1.23 1.23 CCC 1.23 1.23
AAA 1.23 1.23 BBB 1.23 1.23 CCC 1.23 1.23
Ignore the fact that they are all 1.23, I've just used that to make it quicker for me to show. As you can see row 3 has a ------ (representing a rogue character or blank cell) in the 5th column shifting columns 5-9 right one cell.
Now as I said I have a few thousand lines of data like this with maybe 2-3 hundred rows with this problem and I really don't want to manually go through and fix each one.
Is there a tool in excel or a way of using VB to fix this?
Alternatively, is there a way when importing the data to have a number of delimiters rather than the one extra one you can select to remove these on importing?
Maybe it could be fixed by taking any blank cell (or character) and deleting it whilst shifting all cells to the right of it one cell to the left?
I have import the database from SQL server, all the records imported begins with a blank space and they can not be trimmed using Trim function. Is there any smart solution ? I prefer to get VBA code to solve the problem.
View 9 Replies View RelatedUsing VBA to clean up imported data ...
View 9 Replies View Related