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: 23
Default Challenging Formula in VB

Sub HeaderRecord()
ActiveCell.Cells(1, 1).Formula = "ISA~03~TX813080RP~00~ ~ZZ~17512548722~ZZ~TEX COMPTROLLER~" & Range ("YYMMDD") & "~" & Range("Time") & "~U~00401~000000093~0~P~^"
ActiveCell.Cells(2, 1).Formula = "GS~TF~17512548722 ~TEX COMPTROLLER~" & Range("CCYYMMDD") & "~" & Range ("Time") & "~2~X~004010"
ActiveCell.Cells(3, 1).Formula = "ST~813~0001"
ActiveCell.Cells(4, 1).Formula = "BTI~T6~082~47~TX~" & Range("CCYYMMDD") & "~~~~49~17512548722~SV~00000156C~" & Range("Btilineend")
ActiveCell.Cells(5, 1).Formula ="DTM~683~~~~RD8~"& CHOOSE(MOD(VALUE(INDEX(Range("Summary"),Range ("ROWSUM"+1,8)),100),31,28,31,30,31,30,31,31,30,31 ,30,31)


End Sub

I'm hung up right now on the line that has Cells(5,1) in it. Excel keeps giving me the message: Compile error: Expected: Expression, and it highlights the portion "MOD".

I've already tested the following formula, so the "MOD" part of the formula shouldn't be a problem. The standalone formula is:
="DTM~683~~~~RD8~"&CHOOSE(MOD(VALUE(INDEX(Summary, ROWSUM+1,8)),100),31,28,31,30,31,30,31,31,30,31,30 ,31)

and the result string of this formula comes out to be: DTM~683~~~~RD8~31

If I've got the syntax right on the first 4 activecell lines, then why is this one any different? Sure, it has a wild long formula, but if the formula is valid, then why won't it work in VB?

I couldn't wait till Monday to play with this, so I had to go to work and get my data files and bring them back to play at home. I told you guys this project was going to be a doozy.

Thanks,



Bruce








 
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
Challenging Formula Issue Alex Excel Worksheet Functions 1 June 3rd 10 07:56 PM
Challenging formatting formula robnet Excel Worksheet Functions 12 July 19th 07 09:27 PM
Challenging Formula. Need help with writing a formula tom Excel Worksheet Functions 3 July 1st 07 05:50 PM
challenging formula(for me), counting days between dates for multipleyears TG Excel Worksheet Functions 5 April 19th 06 05:31 PM
Answers needed for challenging formula Sum Limit and marking Excel Worksheet Functions 16 April 17th 06 12:15 PM


All times are GMT +1. The time now is 11:21 PM.

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"