Format columns in a listbox as Currency

Lars1

Board Regular
Joined
Feb 3, 2021
Messages
154
Office Version
  1. 365
Platform
  1. Windows
Hi
I am quite new to VBA, and i have a problem with som formats in a listbox.
I would like column 8 and column 10 formatted as currency #.###,## kr the Danish format.

As it is now it comes out with plain numbers like 1000 and the result i am looking for is 1.000,00 kr

There are also two columns formatted as "Short Time", but this is maybe not the best way to format these two columns :)



Private Sub FillContacts(Optional sFilter As String = "*")
Dim i As Long, j As Long

'Clear any existing entries in the ListBox
Me.ListBox1.Clear

'Loop through all the rows and columns of the contact list
For i = LBound(maContacts, 1) To UBound(maContacts, 1)
For j = 1 To 10
'Compare the contact to the filter
If UCase(maContacts(i, j)) Like UCase("*" & sFilter & "*") Then
'Add it to the ListBox
With Me.ListBox1
.AddItem maContacts(i, 1)
.List(.ListCount - 1, 1) = maContacts(i, 2)
.List(.ListCount - 1, 2) = maContacts(i, 3)
.List(.ListCount - 1, 3) = maContacts(i, 4)
.List(.ListCount - 1, 4) = maContacts(i, 5)
.List(.ListCount - 1, 4) = Format(Time, "Short Time")
.List(.ListCount - 1, 5) = maContacts(i, 6)
.List(.ListCount - 1, 5) = Format(Time, "Short Time")
.List(.ListCount - 1, 6) = maContacts(i, 7)
.List(.ListCount - 1, 7) = maContacts(i, 8)
.List(.ListCount - 1, 8) = maContacts(i, 9)
.List(.ListCount - 1, 9) = maContacts(i, 10)
End With
'If any column matched, skip the rest of the columns
'and move to the next contact
Exit For
End If
Next j
Next i
'Select the first contact
If Me.ListBox1.ListCount > 0 Then Me.ListBox1.ListIndex = 0
 
tomorrow is good for me. i will head off. have a good day / evening. cheers
 
Upvote 0

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
tomorrow is good for me. i will head off. have a good day / evening. cheers
Good morning Diddi
I have made some minor changes.
cmdADD button was greyed out all the time after selecting a row in the listBox.
Now it´s back on after clicking FINALISE...
Changed some text etc.

Here is an updated file for you to work on:
 
Upvote 0
Good morning Diddi
I have made some minor changes.
cmdADD button was greyed out all the time after selecting a row in the listBox.
Now it´s back on after clicking FINALISE...
Changed some text etc.

Here is an updated file for you to work on:
Forget about the last download
Please see the new updated file below.
More changes are added.
An approval procedure and the possibility to register a Coffee break.

This new approval feature gives us two oppertunities for filter out some data from the listBox.

Version 1.
We filter out all data where there is text in the Database, column "Godkendt af:" (Approved by:)

Version 2
We filter out all data which is not from today.

 
Upvote 0
well you had best take a look at my ver3 as well based on first file.

and the answer to the question is: lars
the answer to the other question is: bye
Hi Diddi

Looking good, and nice with the password (y)

Have you had a chance to look at the filter in Listbox ?
There is no reason that the users should see all records.

Version 1.
We filter out all data where there is text in the Database, column "Godkendt af:" (Approved by:)
and shows only rows that are not approved yet.

Version 2
We filter out all data which is not from today.
The user get an overview of todays work including approved.
 
Upvote 0
i have not integrated your new code into what i have yet. are there many changes. if yes i can put my new bits into your new vers3
 
Upvote 0
i have not integrated your new code into what i have yet. are there many changes. if yes i can put my new bits into your new vers3
There a a few changes, so if you have the time i would be gratefull :)
 
Upvote 0

Forum statistics

Threads
1,214,968
Messages
6,122,506
Members
449,089
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top