[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Excel workseet range as import or save as text file

Posted on 2012-03-12
11
Medium Priority
?
297 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 41

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
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
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 41

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 2000 total points
ID: 37715482
try this command

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

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

649 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