Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / May 2006

Tip: Looking for answers? Try searching our database.

Urgent Access Loop through Excel on a row

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Trever B - 24 May 2006 01:25 GMT
Hi,

Thanks in advance

What I have at present looks at cells A1 G2 & F3.

What i Need is to have a loop that looks at just a row, lets say row 4 ie
A4,B4, C4 all the way to the end. Not sure I how I refer it cells in a loop
situation and (More to the point where should I be looking to find out)

Dim objBook As Object
Dim objSheet As Object

 Set objBook = GetObject("C:\ExcellFiles\Test_Case.xls")

 For Each objSheet In objBook.Worksheets   'each worksheet
   
   With objSheet
     
     WorkSheet = .Name
     Range = .UsedRange.Address
     CellA1 = .UsedRange.Cells(1, 1).formula
     CellF3 = .UsedRange.Cells(3, 6).formula
     CellG2 = .UsedRange.Cells(2, 7).formula
     
  End With

'do work here

 Next

 Set objSheet = Nothing
 objBook.Close False
 Set objBook = Nothing

Trev
Barry Gilbert - 24 May 2006 17:27 GMT
You can use a variable in place of the column number in the cells property.
For example:
For i = 1 to 15
  Debug.Print Worksheets("MySheetName").Cells(4, i)
Next

You can fnd help on Excel VBA by opening the VBA editor in Excel and opening
help. Tons of good examples there.

HTH,
Barry

> Hi,
>
[quoted text clipped - 32 lines]
>
> Trev
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.