Textboxs & combo Boxs in usefrom to assign them to sheet

Amro El ghazawei

New Member
Joined
Feb 27, 2021
Messages
15
Office Version
  1. 2016
Platform
  1. Windows
Hi,

i create a user from for projects data , with a lot of text boxes & combo boxes, i named each text box & combo box with different names like PO_value , PO_rev .....etc instead of textbox 1,2,3 ....etc.

i assign each textbox/combo box to a column in sheet , using the normal way like

.Cells(iRow, 2) = frmForm.PO_SCOPE.Value
.Cells(iRow, 3) = frmForm.PO_SECTOR.Value

as i said i have more than 200 test box/combo box i wrote the code for the remaining and it work fine , but it takes time for processing it appears like the excel is frozen.

i was thinking to use an array for this assignment but i am not so familiar with array issues
 

diddi

Well-known Member
Joined
May 20, 2004
Messages
3,297
Office Version
  1. 2010
Platform
  1. Windows
so the only values allowed are Q0.1, Q0.2, Q0.3, Q0.4, Q0.5, Q0.6 and Q0.7?
no other letters or numbers?
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Amro El ghazawei

New Member
Joined
Feb 27, 2021
Messages
15
Office Version
  1. 2016
Platform
  1. Windows
so the only values allowed are Q0.1, Q0.2, Q0.3, Q0.4, Q0.5, Q0.6 and Q0.7?
no other letters or numbers?
well, these cell contains the address of input/output devices, it might be different but they all will start either with letter Q OR i and only one number after the decimal point like Q1.0 also the before the decimal it may varies between one or 2 digits like q10.0 , i110,1...etc.
 

Amro El ghazawei

New Member
Joined
Feb 27, 2021
Messages
15
Office Version
  1. 2016
Platform
  1. Windows
well, these cell contains the address of input/output devices, it might be different but they all will start either with letter Q OR i and only one number after the decimal point like Q1.0 also the before the decimal it may varies between one or 2 digits like q10.0 , i110,1...etc.
Hi Diddi,
i solve it with my own , i used the following and it worked ,

If Right(Cell, 1) > 7 Then
Cell.Interior.Color = RGB(255, 0, 0)
you just give me the idea

thanks for your support
 

diddi

Well-known Member
Joined
May 20, 2004
Messages
3,297
Office Version
  1. 2010
Platform
  1. Windows
your are getting more skills at programming! (y)
well done
 

Amro El ghazawei

New Member
Joined
Feb 27, 2021
Messages
15
Office Version
  1. 2016
Platform
  1. Windows

ADVERTISEMENT

Dear Diddi,
How are you?

will i have another question so what do you think

i created a user login to my project, but i am thinking create a levels of authorization and different user names & Password, so i am not sure do you think i should create a new post or we can continue on this post.

Thanks in Advance
 

diddi

Well-known Member
Joined
May 20, 2004
Messages
3,297
Office Version
  1. 2010
Platform
  1. Windows
what code do you have so far
 

Amro El ghazawei

New Member
Joined
Feb 27, 2021
Messages
15
Office Version
  1. 2016
Platform
  1. Windows
what code do you have so far
HI

Please find bellow code

"''''''''''''''''''
Private Sub cmdLogin_Click()

Dim user As String

Dim password As String

user = Me.txtUserID.Value

password = Me.txtPassword.Value

If (user = "admin" And password = "admin") Or (user = "user" And password = "user") Then

Unload Me
Application.Visible = True
Dim Ws As Worksheet
For Each Ws In ActiveWorkbook.Worksheets
Ws.Visible = xlSheetVisible
Next Ws

Dim wksUserLog As Worksheet
Dim lngNextRow As Long



For i = 1 To Worksheets.Count
If Worksheets(i).Name = "User LOG" Then
Exists = True
End If
Next i

If Not Exists Then
Worksheets.Add.Name = "User LOG"
End If



Set wksUserLog = ThisWorkbook.Worksheets("User LOG")
wksUserLog.Range("A1:C1").Value = Array("Username", "Datetime", "Computer name")


With wksUserLog
lngNextRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
.Cells(lngNextRow, "A").Value = Environ("Username")
.Cells(lngNextRow, "B").Value = Now()
.Cells(lngNextRow, "C").Value = Environ$("computername")
.Columns("A:C").AutoFit

'Send mail
'Private Sub CommandButton3_Click()

End With





Else

If LoginInstance < 3 Then

MsgBox "Invalid Login Credentials. Please Try Again.", vbOKOnly + vbSystemModal + vbCritical, "Invalid Login Details"
LoginInstance = LoginInstance + 1
MsgBox LoginInstance, vbCritical, "User Attempts"

Else

MsgBox "You Have Exceeded Maximum NumberS Of Login Attempts.", vbOKOnly + vbSystemModal + vbSystemModal + vbCritical, "Invalid Credentials"
Unload Me
ThisWorkbook.Close Savechanges:=False
Application.Visible = True
LoginInstance = 0

End If

End If

End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,129,514
Messages
5,636,785
Members
416,940
Latest member
JohanT

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
Top