[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 302
  • Last Modified:

Excel workseet range as import or save as text file

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
scbdpm
Asked:
scbdpm
  • 3
  • 3
  • 2
  • +2
1 Solution
 
Kyle AbrahamsSenior .Net DeveloperCommented:
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
 
scbdpmAuthor Commented:
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
 
Jeffrey CoachmanMIS LiasonCommented:
Select the range in Excel
Then copy it.
Then open Access and paste into the Database window or Navigation Pane.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Rey Obrero (Capricorn1)Commented:
<This question is simply for grabbing that data...>
do you want to do this using VBA codes ?
0
 
Jeffrey CoachmanMIS LiasonCommented:
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
 
Jeffrey CoachmanMIS LiasonCommented:
<No points wanted for my posts>
0
 
proxeniaCommented:
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
 
Rey Obrero (Capricorn1)Commented:
scbdpm,

what version of office are you using?
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
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
 
scbdpmAuthor Commented:
capricorn1- Office 2010
0
 
Rey Obrero (Capricorn1)Commented:
try this command

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

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 3
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now