Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim data As AnyDataType ' right (strongly typed)'
- Dim data As Object ' wrong (weakly typed)'
- Dim data ' wrong (weakly typed; defaults to the Object)'
- Dim config As ConfigStruct ' right (when config holds small amount of data)'
- Dim config As ConfigClass ' wrong (when config holds small amount of data)'
- Range("B1").Formula = "Hello there!"
- Range("B1").Formula = "Hello there!"
- Private Sub DoStuff()
- Dim objMyFoo As New FooClass
- ' use objMyFoo
- ' done with objMyFoo
- Set objMyFoo = Nothing
- ' do some more stuff
- End Sub
- For each ctl as Control in Form1.Controls
- Dim string1 as String = ctl.ID
- Dim string2 as String = ctl.ToolTip
- Dim string3 as String = ctl.Text
- Dim string4 as String = ctl.BackColor.ToString()
- 'do things with the strings
- Next
- Dim string1 as String
- Dim string2 as String
- Dim string3 as String
- Dim string4 as String
- For each ctl as Control in Form1.Controls
- string1 = ctl.ID
- string2 = ctl.ToolTip
- string3 = ctl.Text
- string4 = ctl.BackColor.ToString()
- 'do things with the strings
- Next
- For _x as Integer = 0 To 5
- Dim _y as Integer
- If _x % 2 = 0 Then
- _y = _x
- End If
- Console.WriteLine(_y)
- Next
- Dim _y as Integer
- For _x as Integer = 0 To 5
- _y = 0
- If _x % 2 = 0 Then
- _y = _x
- End If
- Console.WriteLine(_y)
- Next
- ' For Buy & Sell Sheets, Fill all ComboBoxes and Clear contents
- For Each initsheet In Worksheets
- If (Left$(initsheet.Name, 3) = "Buy" Or Left$(initsheet.Name, 4) = "Sell") Then
- initsheet.Activate
- For Each cCont In ActiveSheet.OLEObjects
- ' Cycle through all controls, filling all ComboBoxes
- If TypeOf cCont.Object Is MSForms.ComboBox Then
- With cCont
- Select Case Left$(.Name, 5)
- Case "cmbMW"
- .ListFillRange = parSheet.Name & "!" & parSheet.Range("transUnit", Sheet2.Range("transUnit").End(xlDown)).Address
- .Object.ListIndex = 0
- Case "cmbTy"
- .ListFillRange = parSheet.Name & "!" & parSheet.Range("transType", Sheet2.Range("transType").End(xlDown)).Address
- .Object.ListIndex = 0
- Case "cmbCo"
- .ListFillRange = parSheet.Name & "!" & parSheet.Range("transCo", Sheet2.Range("transCo").End(xlDown)).Address
- .Object.ListIndex = 0
- Case "cmbSe"
- .Object.List() = ServerArray
- End Select
- End With
- End If
- Next cCont
- Range("B6:K30").ClearContents
- End If
- Next initsheet
Add Comment
Please, Sign In to add comment