Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
  1. #16
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    It probably would be easier to have preformatted sheet pull data from Access instead of Access pushing to Excel. I have a workbook doing that. See post 6 in https://www.accessforums.net/access/...cel-31411.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  2. #17
    trevor40's Avatar
    trevor40 is offline Advanced db Manager
    Windows XP Access 2003
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    402

    fixed now

    well it's going great now, repacing "Sat" with - " & Chr(34) & "SAT" & Chr(34) & " has fixed the syntax issue and the formula is now accepted, sample of working code below. don't even need the sheet names, all rows in the list are updated correctly as well.

    Current_Worksheet.Range("M8").Formula = "=IF(OR($B8 = " & Chr(34) & "Sat" & Chr(34) & ", $B8 = " & Chr(34) & "Sun" & Chr(34) & "), 0, IF($K8 > 8, 8, $K8))"

    Current_Worksheet.Range("N8").Formula = "=IF($B8=" & Chr(34) & "Sun" & Chr(34) & ",0,IF(AND($B8=" & Chr(34) & "Sat" & Chr(34) & ",$K8<=4),$K8,IF(AND($B8=" & Chr(34) & "Sat" & Chr(34) & ",$K8>4),4,IF(AND($B8<" & Chr(34) & "Sat" & Chr(34) & ",$K8>8,$K8<=11),$K8-8,IF(AND($B8<" & Chr(34) & "Sat" & Chr(34) & ",$K8>11),11-8,0)))))"

    Current_Worksheet.Range("O8").Formula = "=IF($B8=" & Chr(34) & "Sun" & Chr(34) & ",$K8,IF(AND($B8=" & Chr(34) & "Sat" & Chr(34) & ",$K8>4),$K8-4,IF(AND($B8=" & Chr(34) & "Sat" & Chr(34) & ",$K8<=4),0,IF(AND($B8<" & Chr(34) & "Sat" & Chr(34) & ",$K8>11),$K8-11,0))))"

    Current_Worksheet.Range("P8").Formula = "=SUM($M8:$O8)"

    Current_Worksheet.Range("Q8").Formula = "=($O8*2)+($N8*1.5)+$M8"


    thankyou very much for halping with this.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 41
    Last Post: 05-29-2015, 02:58 PM
  2. How to use this formula from Excel in Access?
    By jset818 in forum Queries
    Replies: 11
    Last Post: 10-16-2014, 03:32 PM
  3. Using an Excel Formula in Access
    By BEI77 in forum Access
    Replies: 6
    Last Post: 05-08-2014, 05:08 PM
  4. Excel Formula into Access Query
    By dr4ke in forum Queries
    Replies: 7
    Last Post: 06-25-2012, 06:46 AM
  5. Excel Formula Needed in Access
    By bmschaeffer in forum Queries
    Replies: 4
    Last Post: 01-18-2012, 01:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums