Format a cell using vba from Access application
Power Query Course in Spanish
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Format a cell using vba from Access application

  1. #1
    New Member
    Join Date
    Apr 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    I am creating an Excel spreadsheet from a table in Access 97.

    For intCounter = 2 To rsRecord.fields.Count - 1
    intCount = intCount + 1
    oSheet.range("A" & intCount).Value = IIf(IsNull(rsRecord.fields(intCounter)), "N/A", rsRecord.fields(intCounter))
    Next

    Table contents:
    0
    9
    >576
    PASS

    Excel after running my code:
    A
    1 0
    2 4
    3 >576
    4 PASS

    Populating Excel is working fine.

    I have a second Excel spreadsheet that links to my newly created spreadsheet and pulls the values from the specific cells. In my second spreadsheet I need to do calculations on A1 and A2 but the field format for these cells all are General which means I can't do a numeric calculation on it - if(NewSpreadsheet![A2] >5, ">0", NewSpreadsheet![a2]), the result always turns out to be true.

    I know the code in Access to check to see if the value is numeric before I write it to Excel. (Sometimes the value in A2 will be ">15", this is why I need to check to see its value.)

    What code do I need in Access to format the cell to be numeric before I plug the value in?

    Thanks,
    Terry

  2. #2
    New Member
    Join Date
    Apr 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    I've solved it.

    Thanks,
    Terry

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com