• 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.

How To Put And Enter Symbols In VBA Editor ?

Hany ali

Active Member
Hello My Dear ,How To Put This Symbols In Vba Code
Ï x Ð
when to make Copy From Excel Sheet To Vba Code ,I Found Mistake ,because This Ï Apper As I and this Ð as ?
please i want your help to put all these Symbols an in Excel Sheet & Modify This File With Code.... Thanks Alot
 

Attachments

  • 20.png
    20.png
    26.3 KB · Views: 6
  • User Level Security in Excel File .xlsm
    34.4 KB · Views: 6
I can get this by copying from the sheet:
Code:
Then Target.Value = "Ï"
and it works giving the correct symbol.
If you can't do that then try:
Code:
Then Target.Value = Chr(207)
The other symbol's code is 208.
 
thanks my Dear,but still have problem in this line from Code as You See ..BY THIS
Chr(208)
 

Attachments

  • Untitled.png
    Untitled.png
    148.4 KB · Views: 5
This has nothing to do with the likes of Chr(208).
Fluff is right; in this line you clear those cells:
.Range("B5,B6").ClearContents
which puts "" into cell B8., so when you execute the next line:
UserRow = .Range("B8").Value 'User Row
it puts "" into UserRow. Later
If .Cells(UserRow, SheetCol).Value =…
UserRow doesn't have a valid value.

Try swapping the positions of these lines:
.Range("B5,B6").ClearContents
UserRow = .Range("B8").Value 'User Row
 
thanks Fluff13 ,in B8 ,this Formula
Code:
=IFERROR(MATCH($B$5,UserName,0)+4,"")
thanks mr p45cal
you mean this Code will be
Code:
Option Explicit
Sub CheckUser()
Dim UserRow, SheetCol As Long
Dim SheetNm As String
With Sheet1
.Calculate
If .Range("b8").Value = Empty Then 'Incorrect Username
MsgBox "Please Enter a Correct User Name"
Exit Sub
End If
If .Range("B7").Value <> True Then 'Incorrect Password
MsgBox "Please Enter a Correct Password"
Exit Sub
End If
LoginForm.Hide
UserRow = .Range("B8").Value 'User Row
.Range("B5,B6").ClearContents
For SheetCol = 8 To 13
SheetNm = .Cells(4, SheetCol).Value 'Sheet Name
If .Cells(UserRow, SheetCol).Value = Chr(208) Then
Sheets(SheetNm).Unprotect "123"
Sheets(SheetNm).Visible = xlSheetVisible
End If
If .Cells(UserRow, SheetCol).Value = Chr(207) Then
Sheets(SheetNm).Protect "123"
Sheets(SheetNm).Visible = xlSheetVisible
End If
If .Cells(UserRow, SheetCol).Value = "x" Then Sheets(SheetNm).Visible = xlVeryHidden
Next SheetCol
End With
End Sub
please can you try to Use this File Because When I TRY To open By User hany & Password 123 .. it must be all pages in workbook is Visible why I FOUND Not Visible ?!!!
 

Attachments

  • User Level Security in Excel File .xlsm
    32.5 KB · Views: 5
Last edited:
Seems to make all sheets visible here.
To allow the userform textboxes to adjust cells B5 and B6 you may need to allow vba to override the sheet protection with an added line:
Code:
Private Sub Workbook_Open()
Sheet1.Protect userinterfaceonly:=True, Password:="123" '<<<<<<<<<<added line
LoginForm.Show
End Sub
 
I don't see what's wrong with that. It hides the sheet so most users can't unhide it when there's an x in that cell.
 
Back
Top