Solved

Excel workseet range as import or save as text file

Posted on 2012-03-12
11
286 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
 
LVL 119

Expert Comment

by:Rey Obrero
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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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 119

Expert Comment

by:Rey Obrero
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 119

Accepted Solution

by:
Rey Obrero 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
data analyst 3 50
Alter an update query which rounds 7 33
ms office troubleshooting for users 8 36
VBA pass value between two fields different tables 10 38
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
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, when working with VBA, learn some techniques for writing readable and easily maintained code.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

895 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now