Solved

Excel workseet range as import or save as text file

Posted on 2012-03-12
11
290 Views
Last Modified: 2012-03-13
I am trying to design a database that import in a range of cells/rows from an Excel worksheet to then do some processing on this data.

How can I just grab a range of cells/rows for my database to then 'clean up' that data?

For instance, I need A9 to BB49.

This question is simply for grabbing that data.....
0
Comment
Question by:scbdpm
  • 3
  • 3
  • 2
  • +2
11 Comments
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 37712064
http://support.microsoft.com/kb/291308

To select the range:
ActiveSheet.Range("A9:BB49").Select



Full export here:

http://www.ozgrid.com/forum/showthread.php?t=76720

Sub testexport()
     '
     ' export Macro
     
Dim Dir as String = "C:"
    Range("A9:BB49").Select
    Selection.Copy
    Workbooks.Add
    ActiveSheet.Paste
    ActiveWorkbook. SaveAs Filename:= _
    Dir + "\Test.csv" _
    , FileFormat:=xlCSV, CreateBackup:=False
    Application.DisplayAlerts = False
    ActiveWorkbook.Close
    Application.DisplayAlerts = True
     
End Sub
0
 

Author Comment

by:scbdpm
ID: 37712153
My apologies, I thought I had only chosen Access at topic area.

Not interested in doing it within my Excel worksheet, just the access database.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37712473
Select the range in Excel
Then copy it.
Then open Access and paste into the Database window or Navigation Pane.
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 37712484
<This question is simply for grabbing that data...>
do you want to do this using VBA codes ?
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37712489
In order to "really" do this you have to open an instance of Excel, in Access.
Then do pretty much the same thing as ged325 posted (Only from Access)

I am sure capricorn1 will be able to help you with the exact code.

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37712490
<No points wanted for my posts>
0
 
LVL 1

Expert Comment

by:proxenia
ID: 37712769
Do you want the data linked or just to grab it once?  If you're doing it on one range or Excel sheet to one Access table, you can simply use External Data - Excel - and then link or import depending on which you need.  From there, you select the worksheet or range, whether or not the first row contains headings, and add a primary key if necessary.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 37712820
scbdpm,

what version of office are you using?
0
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 37714646
http://www.accessmvp.com/KDSnell/EXCEL_Import.htm

SELECT T1.*, 1 AS SheetSource
FROM [Excel 8.0;HDR=YES;IMEX=1;Database=C:\MyFolder\MyFile.xls].[WorksheetName$A9:BB49] as T1;
0
 

Author Comment

by:scbdpm
ID: 37715454
capricorn1- Office 2010
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 37715482
try this command

docmd.transferspreadsheet acimport,10, "TableName","C:\folderName\ExcelFile.xlsx",False,"NameOfSheet!A9:BB49"
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question