Solved

Excel workseet range as import or save as text file

Posted on 2012-03-12
11
292 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

717 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