Check out http://www.w3schools.com
Posts by Jong
-
-
This page will help you out. Serialization in VBA is not as easy as serialization in Java.
http://www.vb-helper.com/tut5.htm
Good luck.
-
-
I would think that there would be a function to acheive this. If you cannot find one, then you can code your own.
Lets say this range is a list of unsorted values:
Worksheets("One").Range("A1:A20")
The resulting list will be put in Worksheets("Two").Range("A1:A20")
Code
Display MoreDim ResultCounter as Integer Dim Flag as Boolean ResultCounter = 1 for each Acell in Worksheets("One").Range("A1:A20") Flag = false for each Bcell in Worksheets("Two").Range("A1:A" & ResultCounter) if ACell.Value = BCell.Value then Flag = true exit for end if next BCell if Flag = false then Worksheets("Two").Range("A" & ResultCounter) = ACell.Value ResultCounter = ResultCounter + 1 end if next Acell
I just wrote the above code from memory, it is untested. This should give you a pretty good idea as to what you will need to do what is needed to do. The above code will only work if your list is all located in the same place. It will sort out the duplicates.
Hope it helps.
-
yes.
there is an option when you protect the sheet, to allow the user to "Format Columns"
This will not allow the user to insert data in the cells, but will allow him to resize columns, and hide/unhide columns.
To achieve this, you can click on Tools > Protection > Protect Sheet
Then select "Format Columns"Alternatively, this can be done programatically with the following code:
-
I'm not sure about creating a new control on the fly like that.. but have you considered "hiding/unhiding" the controls?
If you need to create a checkbox, you would just have to set the "Visible" property accordingly.
This is a suggestion, hope it helps
-
-
The easiest way to do this is to create a Public variable. I suggest creating this variable in the location where you are trying to "pass" it to.
For example, lets say this is the Module you wish to pass the string to, and this module is called "Module1":
Module1 Code:
Code'This should be put anywheres in the first lines of code in the module [CODE]Public MyVariable as String
[/CODE]
Userform code:
-
Something like this maybe?
Paste this in the worksheet object where you would like the columns to be hidden. Specify the range you want to check. For my example, I used E1:E30Code
Display MorePrivate Sub Worksheet_SelectionChange(ByVal Target As Range) Dim Flag As Boolean Flag = True 'E1:E30 would correspond to the range that needs to be filled in For Each cell In Me.Range("E1:E30") If cell.value = "" Then Flag = False Exit For End If Next cell If Flag = True Then Me.Columns("F").Hidden = False Else Me.Columns("F").Hidden = True End If End Sub
-
Regular expressions are used like this:
Code
Display More'Init the regex Dim MyExpression as Regex Set MyExpression = new Regex 'Set its properties MyExpression.Global = true MyExpression.Pattern = "*€$" 'Other properties are available to you such as: 'MyExpression.IgnoreCase = true 'Test it against your string if MyExpression.Test(MyString) = true then MsgBox "This string contains the regular expression" else MsgBox "This String does not contain this regular expression" end if
You will need to add a reference to "Microsoft VBScript Regular Expressions" in your VBA Editor > Tools > References.
For more help on Regex patterns, check out http://www.aivosto.com/vbtips/regex.html
-
Here is how i accomplish your requested task:
NOTE: You may have to add a reference to Microsoft scripting Runtime in your VBA Editor (Tools > References)Code
Display MoreSub WriteFile() Dim FileName as String FileName = ThisWorkbook.Path & "\MyFile.exs" Open FileName For Output As #1 Print #1, "Enter what needs to be printed here" Print #1, "Each Print statement will also give you a Line Feed/CR" Print #1, "Cells can be printed too" & Range("C4") 'Close stream when done Close #1 end Sub
-
Have you tried just deleting the rows ?
.EntireRow.Delete?
-
-
-
you can only insert a row or a column
if you insert a cell, it will basically just add a row or column.
-
have you tried XlNone?
-
-
-
-
In your "ThisWorkbook" Object in your VBA Editor, add the following:
CodePrivate Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) 'put code here End Sub
The code will execute before a save takes place. You can then just use whatever function you want to paste the current date/time in whatever location you want.