-
WSMS_fan
AskWoody LoungerYou people are awesome! I can’t thank you enough. THANKS A MILLION for your help!
-
WSMS_fan
AskWoody LoungerI would love to – however I do not have an example – this is what is happening…
I took the formula from Crystal Report and I want to re-do it for Access Report.
What I am trying to do is following:
=IIf([Full/Part Time]=”F” And [Transfer]=0 And [New Hire]=0
*display Name with SUB A Joe, Doe – ERT
([LAST NAME] & “,” & [FIRST NAME] & “-” & ))IIf([Transfer]=0 And [New Hire]=0
*display Name with FT or PT and SUB A like Joe, Doe (F) – ERT
[LAST NAME] & “,” & [FIRST NAME] & ” (” & [FULL/PART TIME] & “) ” & “- ” & )Or IIf([New Hire]=0
*display Name with tilda in front ~ Joe, Doe – ERT to PRT
“~” & [LAST NAME] & “,” & [FIRST NAME] & “-” & [Prior SUB] & ” to ” & ,”+” & [LAST NAME] & “,” & [FIRST NAME] & ” (” & [FULL/PART TIME] & “) ” & “- ” & )else
+” & [LAST NAME] & “,” & [FIRST NAME] & ” (” & [FULL/PART TIME] & “) ” & “- ” & )
*display Name like + Joe, Doe (F) – PRT
________________________________________________________If this was not 100% accurate – below is Crystal’s formula:
if {TABLE1.FULL/PART TIME} = “F” and {TABLE1.Transfer} = 0 and {TABLE1.New Hire} = 0
then
{TABLE1.LAST NAME}& “,”& {TABLE1.FIRST NAME} & “-” & {TABLE1.SUB LOB}
else
if {TABLE1.Transfer} = 0 and {TABLE1.New Hire} = 0
then
{TABLE1.LAST NAME}& “,”& {TABLE1.FIRST NAME}& ” (” & {TABLE1.FULL/PART TIME} &”) “& “- ” & {TABLE1.SUB LOB}
else
if {TABLE1.New Hire} = 0
then
“~” & {TABLE1.LAST NAME}& “,”& {TABLE1.FIRST NAME} & “-” & {TABLE1.Prior SUB} & ” to ” & {TABLE1.SUB LOB}
else
“+” &{TABLE1.LAST NAME}& “,”& {TABLE1.FIRST NAME} & ” (” & {TABLE1.FULL/PART TIME} &”) “& “- ” & {TABLE1.SUB LOB}*********THANKS SO MUCH!!!
-
WSMS_fan
AskWoody LoungerI am using Access 2003.
Where do I enter in a query? Thanks
-
WSMS_fan
AskWoody LoungerFrancois!
It seems like it is all I need! I will have to take a beter look but I see numbers I need.Thanks so much for your time and help and have a great day!
-
WSMS_fan
AskWoody LoungerHans,
I can not believe my own luck to have you as my guide!
THANK YOU SO MUCH – you saved my face again!
And as I said I wish I could repay somehow…some day. -
WSMS_fan
AskWoody LoungerI have 5 Worksheets where only one “JO_MissingFields” has to have this done to it (but ONLY to one column #14)
With xlApp.Intersect(xlWsh.UsedRange, xlWsh.Columns(14)).FormatConditions .Add Type:=2, Formula1:=”=$O1=””Open””” .Item(1).Interior.ColorIndex = 36
End With
________________________________________________
– the rest of columns should stay colored as they were when first code ran.P.S we have to remember that previously “JO_MissingFields” had other code running over it when it colored all blank cells.
Now we do not need those to be changed – we need only those in column 14 colored where $O1=””Open””.It works fine when I ran it alone. When I am running it ‘within the code’ – it gets ignored.
Thanks and I can remove all codes, sorry.
-
WSMS_fan
AskWoody LoungerI know the code is working, however when I am having it outside in another Private Sub – it opens another instance of Excel and works fine
except another instance of Excel is no good.When I am inserting it into an old code – it gets ignored and no changes are happening.
I am trying a whole day and not able to find correct place for this ‘skeleton’…
-
WSMS_fan
AskWoody LoungerHans,
I am getting a message
Method Intersect of object Global has failed.I could not insert new code
__________
With Intersect(xlWsh.UsedRange, xlWsh.Columns(2)).FormatConditions
.Add Type:=xlExpression, Formula1:=”=$C1=””Open”””
.Item(1).Interior.ColorIndex = 36
End With
___________into an old code.
I have instead created new Private Sub and calling it from the end of the previous code.
I will paste a whole thing below but it is just in case you want to see.
[codebox]
Private Sub Color_Cells()Dim xlApp As Object
Dim xlWbk As Object
Dim xlWsh As ObjectDim lngMaxRow As Long
Dim lngMaxCol As Long
Dim r As Long
Dim c As LongSet xlApp = CreateObject(Class:=”Excel.Application”)
Set xlWbk = xlApp.Workbooks.Open(FileName:=strReportName)‘_______________________________________________________________
For Each xlWsh In xlWbk.Worksheets
If xlWsh.Name = “aud_CT_Summary_Totals” Then
lngMaxRow = xlWsh.Cells.Find(What:=”*”, SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
lngMaxCol = xlWsh.Cells.Find(What:=”*”, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).ColumnxlWsh.Cells(lngMaxRow + 1, 1) = “Total:”
For c = 2 To lngMaxCol
xlWsh.Cells(lngMaxRow + 1, c).FormulaR1C1 = “=SUM(R1C:R” & lngMaxRow & “C)”
Next cxlWsh.Cells(lngMaxCol + 1).FormulaR1C1 = “Total”
For r = 2 To lngMaxRow
xlWsh.Cells(r, lngMaxCol + 1).FormulaR1C1 = “=SUM(RC1:RC” & lngMaxCol & “)”
Next rxlWsh.Cells(lngMaxRow + 1, lngMaxCol + 1).FormulaR1C1 = “=SUM(RC1:RC[-1])”
xlWsh.Range(xlWsh.Cells(1, lngMaxCol + 1), xlWsh.Cells(lngMaxRow + 1, lngMaxCol + 1)).Interior.ColorIndex = 36
xlWsh.Range(xlWsh.Cells(1, lngMaxCol + 1), xlWsh.Cells(lngMaxRow + 1, lngMaxCol + 1)).Font.Bold = True
xlWsh.Range(xlWsh.Cells(1, lngMaxCol + 1), xlWsh.Cells(lngMaxRow + 1, lngMaxCol + 1)).Borders.LineStyle = 1xlWsh.Range(xlWsh.Cells(lngMaxRow + 1, 1), xlWsh.Cells(lngMaxRow + 1, lngMaxCol + 1)).Interior.ColorIndex = 36
xlWsh.Range(xlWsh.Cells(lngMaxRow + 1, 1), xlWsh.Cells(lngMaxRow + 1, lngMaxCol + 1)).Font.Bold = True
xlWsh.Range(xlWsh.Cells(lngMaxRow + 1, 1), xlWsh.Cells(lngMaxRow + 1, lngMaxCol + 1)).Borders.LineStyle = 1xlWsh.Range(“A1:D1”).Font.Bold = True
xlWsh.UsedRange.Font.Size = 8.5
xlWsh.Columns(“B:C”).HorizontalAlignment = xlCenter
xlWsh.UsedRange.Columns.AutoFitElse
xlWsh.UsedRange.FormatConditions.Add Type:=1, _
Operator:=3, Formula1:=”=”””””
With xlWsh.UsedRange.FormatConditions(1).Borders
.LineStyle = 1
.Weight = 2
.ColorIndex = -4105
xlWsh.UsedRange.FormatConditions(1).Interior.ColorIndex = 36xlWsh.Range(“A1:AA1″).Font.Bold = True
xlWsh.UsedRange.Font.Size = 8.5
xlWsh.UsedRange.Columns.AutoFitEnd With
End If
Next xlWsh
‘________________________________________________________Call Color_Cells2
xlWbk.Close SaveChanges:=True
xlApp.Quit
Set xlWsh = Nothing
Set xlWbk = Nothing
Set xlApp = NothingEnd Sub
Private Sub Color_Cells2()
Dim xlApp As Object
Dim xlWbk As Object
Dim xlWsh As ObjectSet xlApp = CreateObject(Class:=”Excel.Application”)
Set xlWbk = xlApp.Workbooks.Open(FileName:=strReportName)‘_______________________________________________________________
For Each xlWsh In xlWbk.Worksheets
If xlWsh.Name = “aud_JO_MissingFields” Then
With Intersect(xlWsh.UsedRange, xlWsh.Columns(14)).FormatConditions
.Add Type:=xlExpression, Formula1:=”=$O1=””Open”””
.Item(1).Interior.ColorIndex = 36
End WithEnd If
Next xlWshEnd Sub
[/codebox]
________________________________The error happening at
With Intersect(xlWsh.UsedRange, xlWsh.Columns(14)).FormatConditions
line.Thanks for looking into this.
P.S. My actual columns is #14 and ‘Open’ value in column O.
-
WSMS_fan
AskWoody LoungerThat was the question. Not sure why in quote window.
I said:
I have 5 worksheets and this ‘issue’ is only pertaining to one.
So I had tried code below and it did not change anything:
xlWsh.UsedRange.FormatConditions.Add Type:=1, _
Operator:=3, Formula1:=”=”””””
With xlWsh.UsedRange.FormatConditions(1).Borders
.LineStyle = 1
.Weight = 2
.ColorIndex = -4105
xlWsh.UsedRange.FormatConditions(1).Interior.ColorIndex = 36End With
If xlWsh.Name = “Problem_WKsheet” Then
With Intersect(xlWsh.UsedRange, xlWsh.Columns(2)).FormatConditions
.Add Type:=xlExpression, Formula1:=”=$C1=””Open”””
.Item(1).Interior.ColorIndex = 36
End WithEnd If
___________Sorry for the confusion.
-
WSMS_fan
AskWoody LoungerGood Morning again
I had just gotten ane small but nasty request.
I am highlighting empty cells in workbook when data looking like this:
ID_________StartDate_______JobStatus__JobID_____StartDatePast
11_________5/1/2009_________Filled_____333_________________
12_________6/1/2009_________Open_____231________1/1/2009
23_________[______]_________Filled_____543_________________For the ID 23 – StartDate should be highlighted (because is blank) – which it is and it is great.
NOW I need to highlight only those StartDatePast – where values are having JobStatus = Open.
________________________________________________________________________________
_How can I redo this code:
xlWsh.UsedRange.FormatConditions.Add Type:=1, _
Operator:=3, Formula1:=”=”””””
With xlWsh.UsedRange.FormatConditions(1).Borders
.LineStyle = 1
.Weight = 2
.ColorIndex = -4105
xlWsh.UsedRange.FormatConditions(1).Interior.ColorIndex = 36to all of a sudden stop looking for the blanks and start looking for the condition:
If value of the column C = ‘Open’ then color corresponding cell in column B (if not blank).Thanks for looking into it.
-
WSMS_fan
AskWoody LoungerI have also done this:
xlWsh.Range(xlWsh.Cells(1, lngMaxCol + 1), xlWsh.Cells(lngMaxRow + 1, lngMaxCol + 1)).Interior.ColorIndex = 36
xlWsh.Range(xlWsh.Cells(1, lngMaxCol + 1), xlWsh.Cells(lngMaxRow + 1, lngMaxCol + 1)).Font.Bold = True
xlWsh.Range(xlWsh.Cells(lngMaxRow + 1, 1), xlWsh.Cells(lngMaxRow + 1, lngMaxCol + 1)).Interior.ColorIndex = 36
xlWsh.Range(xlWsh.Cells(lngMaxRow + 1, 1), xlWsh.Cells(lngMaxRow + 1, lngMaxCol + 1)).Font.Bold = TrueIT WORKED!!!!!!!!!!!!
Thanks so much for this wonderful Report.
Best wishes and thank you. -
WSMS_fan
AskWoody LoungerAll is working, I am so greatfull as always.
I am trying to color lngMaxRow and lngMaxCol so my totals will be nicely ‘framed’. Please…help…?
-
WSMS_fan
AskWoody LoungerGreat! Thank you.
I think the last thing I need for this one is when I am having
For Each xlWsh In xlWbk.Worksheets
and
Next xlWsh
and I need to do
If xlWks.Name “FirstWksheet” then
*********
*********else
If xlWks.Name=”FirstWksheet” then
********
End If
End If__________________________________
However I place my IFs – I am getting an errors. Please, show me how to place it correctly. Thanks
-
WSMS_fan
AskWoody LoungerA1cell
ID_____________________________1
12_____________________________2
11_____________________________3
13_____________________________1
15_____________________________3
Totals:____1_2_3_1_3___Sum:10I do not want total in ID column. I want a word “Total:” instead.
Thanks for the first one and thanks in general :-))
-
WSMS_fan
AskWoody LoungerGood Day!
When I am counting blanks I am using COUNTBLANKS, what should I do to count column’s total when no blanks present?
Also I have a first column as IS or Name and column A don’t have to be totaled. I would like to insert word ‘total’ into it. Is there way? Thanks
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Extended Windows Built-in Disk Cleanup Utility
by
bbearren
5 hours, 12 minutes ago -
Win 11 24H2 June 2025 Update breaks WIFI
by
dportenlanger
8 hours, 52 minutes ago -
Update from WinPro 10 v. 1511 on T460p?
by
CatoRenasci
6 hours, 9 minutes ago -
System Restore and Updates Paused
by
veteran
11 hours, 22 minutes ago -
Windows 10/11 clock app
by
Kathy Stevens
5 hours, 24 minutes ago -
Turn off right-click draw
by
Charles Billow
14 hours, 36 minutes ago -
Introducing ChromeOS M137 to The Stable Channel
by
Alex5723
18 hours, 7 minutes ago -
Brian Wilson (The Beach Boys) R.I.P
by
Alex5723
1 hour, 12 minutes ago -
Master patch listing for June 10, 2025
by
Susan Bradley
19 hours, 44 minutes ago -
Suggestions for New All in One Printer and a Photo Printer Windows 10
by
Win7and10
2 hours, 17 minutes ago -
Purchasing New Printer. Uninstall old Printer Software First?
by
Win7and10
1 day, 1 hour ago -
KB5060842 Issue (Minor)
by
AC641
1 day, 6 hours ago -
EchoLeak : Zero Click M365 Copilot leak sensitive information
by
Alex5723
1 day, 8 hours ago -
24H2 may not be offered June updates
by
Susan Bradley
1 hour, 27 minutes ago -
Acronis : Tracking Chaos RAT’s evolution (Windows, Linux)
by
Alex5723
1 day, 21 hours ago -
June 2025 updates are out
by
Susan Bradley
9 hours, 42 minutes ago -
Mozilla shutting Deep Fake Detector
by
Alex5723
2 days, 12 hours ago -
Windows-Maintenance-Tool (.bat)
by
Alex5723
1 day, 21 hours ago -
Windows 11 Insider Preview build 26200.5641 released to DEV
by
joep517
2 days, 14 hours ago -
Windows 11 Insider Preview build 26120.4250 (24H2) released to BETA
by
joep517
2 days, 14 hours ago -
Install Office 365 Outlook classic on new Win11 machine
by
WSrcull999
2 days, 14 hours ago -
win 10 to win 11 with cpu/mb replacement
by
aquatarkus
2 days, 6 hours ago -
re-install Windows Security
by
CWBillow
2 days, 18 hours ago -
WWDC 2025 Recap: All of Apple’s NEW Features in 10 Minutes!
by
Alex5723
2 days, 21 hours ago -
macOS Tahoe 26
by
Alex5723
2 days, 15 hours ago -
Migrating from win10 to win11, instructions coming?
by
astro46
6 hours, 34 minutes ago -
Device Eligibility for Apple 2026 Operating Systems due this Fall
by
PKCano
2 days, 6 hours ago -
Recommended watching : Mountainhead movie
by
Alex5723
2 days, 7 hours ago -
End of support for Windows 10
by
Old enough to know better
5 hours, 59 minutes ago -
What goes on inside an LLM
by
Michael Covington
6 hours, 55 minutes ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.