Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Numberformat: automation from MS Access

From access i am creating excel workbooks and worksheets within each
workbook. I am using a template, which opens with one worksheet. I add the
data I need to this sheet, copy the sheet forward and loop through my
recordset until recordset = EOF.

My problem is that the number formatting does not copy forward from the
original sheet. The original sheet remains the same, but each sheet my
routine copies, contains incorrect formatting. I even attempted to format
the cells in the code, but it will not "take". See the section of my code
below that attempts to do this.

xlApp.Range("E15").Value = "'" & strPer1 'Period 1 label
xlApp.Range("E16").Value = rsData.Fields(3).Value 'Period 1 value+
xlApp.Range("E16").NumberFormat = "#,##0_);[Red](#,##0_)"

What am i doing wrong? Is it an excel default issue? template?

Thanks in advance

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Numberformat: automation from MS Access

My problem is that the number formatting does not copy forward from the
original sheet. The original sheet remains the same, but each sheet my
routine copies, contains incorrect formatting. I even attempted to format
the cells in the code, but it will not "take". See the section of my code
below that attempts to do this.

xlApp.Range("E15").Value = "'" & strPer1 'Period 1 label
xlApp.Range("E16").Value = rsData.Fields(3).Value 'Period 1 value+
xlApp.Range("E16").NumberFormat = "#,##0_);[Red](#,##0_)"

What am i doing wrong? Is it an excel default issue? template?



Sorry not to answer your actual question, but the Copy() method might help:

'---------------------------------

' The two sheets can come from different workbooks.
Dim srcWSheet As Worksheet
Dim dstWSheet As Worksheet

Set srcWSheet = ThisWorkbook.Worksheets(1)
Set dstWSheet = ThisWorkbook.Worksheets(2)

' Copy one cell from src - dst
srcWSheet.Range("E16").Copy dstWSheet.Range("E16")

' Copy a range from scr - dst
srcWSheet.Range("A1:B5").Copy dstWSheet.Range("E3:F7")

' Copy the whole sheet
srcWSheet.Rows.EntireColumn.Copy dstWSheet.Range("A1")

'---------------------------------

arunkhemlai





Thanks in advance

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
Excel automation through .NET Interop: NumberFormat property looks like NumberFormatLocal martin durtschi Excel Programming 4 May 13th 14 07:39 PM
automation from access into excel SAm Excel Discussion (Misc queries) 7 January 27th 06 02:49 AM
Numberformat for Cells using Automation bavjean Excel Programming 3 February 8th 05 12:07 PM
Access 2000 - Automation example please Matt. Excel Programming 1 October 9th 03 09:20 PM
Automation Excel & Access GarethG Excel Programming 6 October 3rd 03 09:14 AM


All times are GMT +1. The time now is 09:39 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"