LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Offset and ActiveCell

Office03

Hey gang,

Have tried to get some assistance in the Access group with limited success
for formatting, but I need some VBA help in referencing Excel from Access.

All code is in Access. I am looping through a recordset and writing data to
an Excel template. The data is being written down-then-across from column to
column. "A2" is always the starting point and I am using an offset to move to
each column and then move downward to write data.

I am having problems setting the reference to the new cell (activating the
cell) in using Offset and then being able to write data to that cell and
format it appropriately.

Any help, clean-up, suggestions are appreciated!

I've eliminated working code to shorten the post but have kept (and
double-checked) all paired IF, WITH, etc., statements

....Working code before this, dim statements, etc.

Set objWkbk = objExcel.workbooks.Open(stTemplate)
x = 0
y = 1

....working code...

Set rs = db.OpenRecordset(sSQL)
stCell = "A2"
rs.MoveFirst

With objWkbk
.sheets("Sheet1").Select
.sheets("Sheet1").Activate
.sheets("Sheet1").Name = stSheetName
irow = 2
icolumn = 1
Do While Not rs.EOF
icolumn = icolumn + x
CName = rs("CourtName")
.....series of IF statements to set variables......

With .ActiveSheet

....ERROR on the following line. Msg: Object doesn't support this property or
method

.ActiveCell.Offset(0, icolumn).Activate

With ActiveCell
.Value = CName
.HorizontalAlignment = xlcenter
.Font.Bold = True
End With

CID = rs("CourtID")
Do While CID = rs("CourtID")
TID = rs("MatchTimeID")
Do While TID = rs("MatchTimeID")
....write data here (once I get the above problem
resolved)....
Loop
TID = -1
Loop
End With
CID = -1
x = x + 1
Loop
End With

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
If activecell.column = variable then activecell,offset (0,1) Battykoda via OfficeKB.com Excel Discussion (Misc queries) 1 October 2nd 07 08:05 PM
ActiveCell Offset rnrss[_2_] Excel Programming 0 October 7th 05 10:12 AM
Activecell Offset Mark Excel Programming 2 December 7th 04 04:57 PM
ActiveCell.Offset w/ VBA Bob Umlas[_3_] Excel Programming 2 September 4th 04 02:58 PM
activecell offset rvik Excel Programming 1 December 24th 03 07:47 AM


All times are GMT +1. The time now is 02:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"