qadirsyed
New Member
- Joined
- Mar 6, 2022
- Messages
- 11
- Office Version
- 2019
- Platform
- Windows
- MacOS
- Mobile
- Web
Hello to all,
As you already know i am new to this forum. I am a trying to create a userform which will be used by multiple users. My form is currently working properly but I need to make a few adjustments in coding which due to my lack of knowledge im unable to. What I want is that each user should be able to see only what he enterted in the listboxt except the "ONE USER" who can see all.
the name of my User form is frmReq and current user is in textbox=txtActiveUser. Currently my form is using "rowsource" method to populate the data so it is populating the entire range.
My data sheet name is "Requisitions" and listbox name is lstdatabase. I would be highly obliged if anyone here can guide me through......
As you already know i am new to this forum. I am a trying to create a userform which will be used by multiple users. My form is currently working properly but I need to make a few adjustments in coding which due to my lack of knowledge im unable to. What I want is that each user should be able to see only what he enterted in the listboxt except the "ONE USER" who can see all.
the name of my User form is frmReq and current user is in textbox=txtActiveUser. Currently my form is using "rowsource" method to populate the data so it is populating the entire range.
My data sheet name is "Requisitions" and listbox name is lstdatabase. I would be highly obliged if anyone here can guide me through......
VBA Code:
Dim iRow As Long
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Privacy Page")
Dim dsh As Worksheet
Set dsh = ThisWorkbook.Sheets("Requisitions")
iRow = [Counta(Requisitions!A:A)] ' idetifying the last row
With frmReq
.txtRq.Value = "" '>>>>>> Demand Text box Clear
.CmbCompany.Clear '>>>>>> List in Company Clear
.CmbCompany.AddItem "ABEL"
.CmbCompany.AddItem "NAM"
.CmbCompany.AddItem "NAMCO"
.CmbCompany.AddItem "ANN"
.CmbProject.Clear '>>>>>> List in Projects Clear
.CmbProject.AddItem "Water"
.CmbProject.AddItem "A"
.CmbProject.AddItem "B"
.CmbProject.AddItem "C"
.CmbProject.AddItem "D"
.CmbPlant.Clear '>>>>>> List in PLANTS Clear
.CmbPlant.AddItem "JHANG"
.CmbPlant.AddItem "JAHANIAN"
.CmbPlant.AddItem "JAHANGIRA"
.CmbPlant.AddItem "SAHIWAL"
.CmbPlant.AddItem "PHED-I"
.CmbPlant.AddItem "WASA-III"
.CmbPlant.AddItem "PHED-SKP"
.CmbPlant.AddItem "Court-Darbar Shareef"
.txtDes.Value = ""
.CmbAccountHd.Clear '>>>>>> List in Account Heads Clear
.CmbAccountHd.AddItem "Operators Salaries"
.CmbAccountHd.AddItem "Electricity Bills"
.CmbAccountHd.AddItem "Water Test Report"
.CmbAccountHd.AddItem "R&M Expenses"
.CmbAccountHd.AddItem "R& m(SBM)"
.CmbAccountHd.AddItem "Hanzala (Technician)"
.CmbAccountHd.AddItem "P.C.Wire 7/16 inch"
.CmbAccountHd.AddItem "P.C.Wire 3/8 inch"
.CmbAccountHd.AddItem "Cement"
.CmbAccountHd.AddItem "Wire - 5mm"
.CmbAccountHd.AddItem "F.oil"
.CmbAccountHd.AddItem "Diesel"
.CmbAccountHd.AddItem "Binding wire"
.CmbAccountHd.AddItem "Welding Holder 800 amp"
.CmbAccountHd.AddItem "Nylon Pipe for cabel 1 inch dia"
.CmbAccountHd.AddItem "Bearing 11003 - 3534 - A"
.CmbAccountHd.AddItem "Grips 3/8 inch with body"
.CmbAccountHd.AddItem "Bitumen paint"
.CmbAccountHd.AddItem "LDO"
.CmbAccountHd.AddItem "LDO"
.CmbAccountHd.AddItem "Gloves Cloth"
.CmbAccountHd.AddItem "LDO"
.CmbAccountHd.AddItem "Red Pump - Faisal"
.CmbAccountHd.AddItem "Flang OD- 11 inch thik-1 inch"
.CmbAccountHd.AddItem "Gear Box: Ratio: 1-31"
.CmbAccountHd.AddItem "Turpal 15 x 20 ft Water proof"
.CmbAccountHd.AddItem "Cabel 7/44 Flexible 3-core"
.CmbAccountHd.AddItem "Nylon Pipe for cabel 1 inch dia"
.CmbAccountHd.AddItem "Cabel 7/36 Flexible 3-core"
.CmbAccountHd.AddItem "Motor 20 HP/1450 (Techo)"
.CmbAccountHd.AddItem "Nut with Boalt 6 inch x 6 inch half thread and with washers ( Complete Set)"
.CmbAccountHd.AddItem "Nut Boalt 5''' x 5 inch"
.CmbAccountHd.AddItem "Boiler Chemical"
.CmbAccountHd.AddItem "Welding Rod - No - 10"
.CmbAccountHd.AddItem "Grease S.T in Tin(F.Quality)"
.CmbAccountHd.AddItem "Grease ( Low Quality )"
.CmbAccountHd.AddItem "Breaker 150 Amp 3-P"
.CmbAccountHd.AddItem "Grips 3/8 inch with body"
.CmbAccountHd.AddItem "Cement Fare Charges"
.CmbAccountHd.AddItem "Crush"
.CmbAccountHd.AddItem "Sand"
.CmbAccountHd.AddItem "P.C. Wire, 5mm & Steel Fare"
.CmbAccountHd.AddItem "Light Diesel"
.CmbAccountHd.AddItem "Diesel For Generator"
.CmbAccountHd.AddItem "Curing Compound Fare"
.CmbAccountHd.AddItem "Bitumen Paint (Fare only )"
.CmbAccountHd.AddItem "Kerosene Oil"
.CmbAccountHd.AddItem "Electricity Charges"
.CmbAccountHd.AddItem "Labor Wages"
.CmbAccountHd.AddItem "Staff Salary"
.CmbAccountHd.AddItem "Repairs of Machines"
.CmbAccountHd.AddItem "Vehicle Repair"
.CmbAccountHd.AddItem "P.O.L"
.CmbAccountHd.AddItem "Mess"
.CmbAccountHd.AddItem "Entertainment"
.CmbAccountHd.AddItem "Wooden Bally"
.CmbAccountHd.AddItem "Miscellaneous"
.CmbAccountHd.AddItem "T.A. & Carriage"
.CmbAccountHd.AddItem "Taxes"
.CmbAccountHd.AddItem "Extra Purchase(Poles)"
.CmbAccountHd.AddItem "PC , Bills"
.CmbAccountHd.AddItem "Poles Shifting Charges"
.CmbAccountHd.AddItem "Other Expenses"
.CmbUOM.Clear '>>>>>> List in Unit of Measurement(UOM)Clear
.CmbUOM.AddItem "Kg"
.CmbUOM.AddItem "Ton"
.CmbUOM.AddItem "No"
.CmbUOM.AddItem "Ltr"
.CmbUOM.AddItem "Pack"
.CmbUOM.AddItem "Bag"
.CmbUOM.AddItem "Rft"
.CmbUOM.AddItem "Dozen"
.CmbUOM.AddItem "Drum"
.CmbUOM.AddItem "Tin"
.CmbUOM.AddItem "Carton"
.CmbUOM.AddItem "Bundle"
.CmbUOM.AddItem "Roll"
.CmbUOM.AddItem "Meter"
.CmbUOM.AddItem "Other"
.TxtRate.Value = ""
.TxtQty.Value = ""
.TxtQty2.Value = ""
.TxtQty3.Value = ""
.txtAmtRq.Value = ""
.TxtApQty1.Value = ""
.TxtApQty2.Value = ""
.TxtApQty3.Value = ""
.TxtAmtAp.Value = ""
.TxtPending.Value = ""
.CmbStatus.Clear '>>>>>>>>>> List in Approval Status Clear
.CmbStatus.AddItem "Pending"
.CmbStatus.AddItem "Approved"
.CmbStatus.AddItem "Partial Approval"
.CmbStatus.AddItem "Unapproved"
.txtRowNumber.Value = ""
'''''''''' Filter_by List
With frmReq
.cmb_Filter_By.Clear
.cmb_Filter_By.AddItem "ALL"
.cmb_Filter_By.AddItem "Demand No."
.cmb_Filter_By.AddItem "Project"
.cmb_Filter_By.AddItem "Company"
.cmb_Filter_By.AddItem "Plant"
.cmb_Filter_By.AddItem "Account Head"
.cmb_Filter_By.AddItem "Approval Status"
'.cmb_Filter_By.AddItem "Pending Amount"
.cmb_Filter_By.Value = "ALL"
End With
'''''''''' Sort by List
With frmReq
.cmb_Sort_by.Clear
.cmb_Sort_by.AddItem "Sr. No."
.cmb_Sort_by.AddItem "Demand No."
.cmb_Sort_by.AddItem "Project"
.cmb_Sort_by.AddItem "Company"
.cmb_Sort_by.AddItem "Plant"
.cmb_Sort_by.AddItem "Account Head"
.cmb_Sort_by.AddItem "Approval Status"
.cmb_Sort_by.AddItem "Pending Amount"
End With
.lstDatabase.ColumnCount = 21
.lstDatabase.ColumnHeads = True
.lstDatabase.ColumnWidths = "30,55,55,55,70,150,100,35,40,40,40,52,65,45,45,45,65,70,80,90,70"
If iRow > 1 Then
.lstDatabase.RowSource = "Requisitions!A2:U" & iRow
Else
.lstDatabase.RowSource = "Requisitions!A2:U2"
End If
End With