• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Guide line Required for listbox.

Hi to everyone,

Dear friends I am working on an excel vba project.i have done everything successfully but I am facing a problem.

I have one sheet on excel(Attendance) , one userfom where I have one list box with three colums i.e No,ID,Employee Name , Disignation and one text box to put the no of absents.All the items on the list box are already available in the excel sheet.I mean I don’t want to select any item and copy them to sheet. I just want that when someone enter the no of absents in the text box,this no should appear on the excel sheet (Attendence) based on ID.For better understand I have attached a screen shot.Please guide me by any experience person.ThanksSA.JPG
 
Hi:

Find the attached.

Thanks
First of All i m very thankful to you for your nice support and response.
My problem is still here and not solved , i think you don't understand my problem.I have simplify my file to better understand.i have also attached a screen shot .Please review my screen shot and file .Thank you



▬▬▬▬▬▬▬▬▬ Mod edit : thread moved to appropriate forum !
 

Attachments

vletm

Excel Ninja
Maybe You simplify a little too much ...
There are two sheets - both five rows data and an userform.
Do You mean that someone would make whole [new] code for this?
 
No no just required a few hints plz....i have all the code for the list but here i don't know how to put value only on the bases of ID in the listbox.
 
Last edited:

vletm

Excel Ninja
1) There should be 'Absents'-sheet somewhere,
it would be a challenge without it.
2) Question: Why need to move BOTH values
'Total day' & 'Put Absents' ~hmm~ 'balance days' ?
You know how many days are in every month and
if later need to know those 'balance days' then 'just solve' it from sheet
 
you are correct it is very simple but the main sheet having very complicated calculation.so i want everything to be automated.i have already write the code for total days in a month.so i want that when the total days is calculated in a month automatically ,then i want to enter only the absents of an employee and put the remaining days on the bases of ID selected under the current month.
 

vletm

Excel Ninja
1) ?
After You have solved that
You could add 'balance days' as 'Total days'.
2) If 'very complicated calculation' then gotta careful with 'Delete' or any mistakes...
 
1) ?
After You have solved that
You could add 'balance days' as 'Total days'.
2) If 'very complicated calculation' then gotta careful with 'Delete' or any mistakes...
My Question is very simple.I have done all other calculation and code.i Just required that how it is possible to enter only the value from a textbox to sheet with criteria depending on the list box.In my case the criteria is ID.
 
Code:
Private Sub OKButton_Click()

Dim i As Integer

For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then

'code or hints required here

End If
Next i

End Sub
 

vletm

Excel Ninja
1) ReRead #8 => There should be 'Absents'-sheet somewhere
2) Find/Match that ID-row from that 'missing sheet' or
if just same amount of rows then use that information (act_row).
3) Find/Solve current month's column (act_cal) from that sheet
4) Copy value like next:
Sheets("Absents").cells(act_row,act_col) = UserForm1.TextBox1.Value
sometimes it would be good to read more that the last row or sentence
 
Code:
PrivateSub OKButton_Click()
Dim totlMonthDys as intiger
Dim absent as intiger
Dim blncedays as intiger
Dim i As Integer

totlMonthDys=Textbox1.value  'Total Days in a month
absent=TextBox2.Value  'total absents putting it manually
blncedays=totlMonthDys-absent 'balance days of employee
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then

'I want blncedays here in front of selected id, I have no absent sheet ,the absent is a manuall entry
EndIf
Next i

EndSub
 
Last edited:

vletm

Excel Ninja
Okay, my last answer for this case

You wrote too
No no just required a few hints plz (#7)
and finally
i have no sheet for absents (#14)after that
it is impossible to continue!
- Take care -
 
Top