Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro Problem

I'm having problems with my Macro. It has to grab info from many
spreadsheets and output it to another. For some reason I can't change
the focus correctly and the output ends up on another worksheet (the
one calling the macro).
The code snippit below should output this to a spreadsheet in five
columns, but it never puts anything on this spreadsheet at all.

Any ideas/solutions would be greatly appreciated.

Set objExcelOut = New Excel.Application
objExcelOut.Visible = True
Set objWrkBookOut = objExcelOut.Workbooks.Open(outFilePath &
outFileName)
Set objWrkSheetOut = objWrkBookOut.Worksheets(shtNameOut)

'write the values to the output file
objWrkSheetOut.Activate
objWrkSheetOut.Range("A" & (rowTotal + 1)).Activate
For c = 0 To inColCount
For r = 0 To actualRows
ActiveCell.Value = costCentre
ActiveCell.Offset(0, 1).Activate
ActiveCell.Value = EndDate(c)
ActiveCell.Offset(0, 1).Activate
ActiveCell.Value = groupID(r)
ActiveCell.Offset(0, 1).Activate
ActiveCell.Value = unit(r, c)
ActiveCell.Offset(0, 1).Activate
ActiveCell.Value = amount
ActiveCell.Offset(1, -4).Activate
rowTotal = rowTotal + 1
Next r
Next c
Reply
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
Macro problem ub Excel Discussion (Misc queries) 1 April 3rd 09 05:43 AM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Worksheet Functions 1 May 3rd 08 02:35 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Discussion (Misc queries) 1 May 3rd 08 10:52 AM
Macro problem [email protected][_2_] Excel Discussion (Misc queries) 2 March 4th 08 11:48 PM
Problem with a macro OldRod Excel Programming 3 July 27th 04 05:24 PM


All times are GMT +1. The time now is 10:37 AM.

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

About Us

"It's about Microsoft Excel"