HTML Code Test --- post23344
Code:
' Slightly modified with lots of Comments
Sub RickRothsteinsConcatenatingBalls()
'NOTE: Change the ## A1 to the address of the top left cell of your
'existing data and change the '### G1 to the address of the top left cell where you want the converted table to go to.
**Const ExistingTableAnyCellLocation As String = "A1" '##
**Const NewTableLHCornerLocation As String = "G1" '###
**
**Dim SourceTableRange As Range 'Give a name and allow all methods and properties of range object to it
**Set SourceTableRange = Range(ExistingTableAnyCellLocation).CurrentRegion ' Give this a specific Range. CurrentRegiuon Property applied to a cell returns a complete range incorporating that cell and any ranges that it either is in or touches
**Dim SourceTableRangeTableRowsCount As Byte ' For a small Table allow it to hve up to 255 Rows
**Let SourceTableRangeTableRowsCount = SourceTableRange.Rows.Count ' This returns the number of rows in the original table
**Dim FinalTableFirstColumnRange As Range
**Set FinalTableFirstColumnRange = Range(NewTableLHCornerLocation).Resize(SourceTableRangeTableRowsCount) ' Here the resize Property applied to the Range G1 (or Cell G1 here) returns a range increased by the row number, that is to say a range equal to the first column
**
**SourceTableRange.Columns(1).Resize(, 2).Copy Destination:=FinalTableFirstColumnRange ' This is one way of copying the first two columns of the original table to The final table
**FinalTableFirstColumnRange.Columns(2).NumberFormat = "@" ' This gives a format to the second column in the final Table
**
**'FinalTableFirstColumnRange.Offset(0, 1) = _
**'Evaluate("IF(ROW()," & SourceTableRange.Columns(2).Address & "&"" - ""&" & SourceTableRange.Columns(3).Address & "&"" - ""&" & SourceTableRange.Columns(4).Address & ")")
**'FinalTableFirstColumnRange.Offset(0, 1) = _
**'Evaluate("** " & SourceTableRange.Columns(2).Address & "&"" - ""&" & SourceTableRange.Columns(3).Address & "&"" - ""&" & SourceTableRange.Columns(4).Address & "")
** FinalTableFirstColumnRange.Offset(0, 1) = _
****************Evaluate("** " & SourceTableRange.Columns(2).Address & "**** " & "&"" - ""&" & " " & SourceTableRange.Columns(3).Address & "**" & "&"" - ""&" & "" & SourceTableRange.Columns(4).Address & "")
**
**SourceTableRange.Columns(5).Copy Destination:=FinalTableFirstColumnRange.Offset(, 2) 'Column 5 of Original table is copied to column 3 of the Final table by setting the destination to 2 colums offset from the first column
**
**FinalTableFirstColumnRange.Cells(1, 0).Offset(0, 1).Value = "Numbers" ' The current heading in the second column is finally overwriten with "Numbers".**This is done here by putting the value"Numbers" in the cell which is offset by 1 column to the first cell in the Final Table First Column
End Sub 'RickRothsteinsConcatenatingBalls()
'
Named Ranges and Named Ranges scope. Referencing a named
Code:
Dim ilSanityCheck As Integer
Dim llEndLine As Long
Set olPane = Application.VBE.ActiveCodePane
olPane.GetSelection Startline:=llSRow, startcolumn:=llSCol, Endline:=llERow, Endcolumn:=llECol
slProcName = olPane.CodeModule.ProcOfLine(llSRow, vbext_pk_Proc)
llLine1 = olPane.CodeModule.ProcBodyLine(slProcName, vbext_pk_Proc)
llCountLines = olPane.CodeModule.ProcCountLines(slProcName, vbext_pk_Proc)
llStartLine = olPane.CodeModule.ProcStartLine(slProcName, vbext_pk_Proc)
llEndLine = llStartLine + llCountLines - 1
' Find Dim Line.
llCompLine1 = llLine1
Do
slOLine1 = Trim$(olPane.CodeModule.Lines(llCompLine1, 1))
If Left$(slOLine1, 4) = "Dim " Then
Exit Do
ElseIf Left$(slOLine1, 6) = "Const " Then
Example VBIDE Microsoft Visual Basic for Applications Extensibility 5.3 For coding coding
Code:
Dim llCountLines As Long
Dim ilSanityCheck As Integer
Dim llEndLine As Long
Dim procKind As Long
'Set up a codepane object for where the cursor is in the sub. For this example, where you placed it. Setting a variable makes the code more readable and a mite shorter instead of using Application.VBE.ActiveCodePane all the time.
Set olPane = Application.VBE.ActiveCodePane ' Setting a variable makes the code more readable and a mite shorter instead of using Application.VBE.ActiveCodePane all the time.
' GetSelection returns the position info for our selection and places those row and column numbers in our chosen variables
olPane.GetSelection Startline:=llSRow, startcolumn:=llSCol, Endline:=llERow, Endcolumn:=llECol
' This is a bit of a wierdo: ProcOfLine function returns the name of the Procedure for the given line. We can use for example the returned selection start row. The wierd thing is that the second srgument is returned to us, that is to say that returns the number VBA uses to identify the procedure type. For ProcBodyLine, ProcCountLines, and ProcStartLine, we need the procedure name. PocOfLine will return it. For those functions, we also need to know the pk (procedure kind) or type. ProcOfLine returns that as well. In fact, it's the only procedure that will give us the proc type. Once we have it, we can plug it into the other calls. This makes where you put this call important. It has to be before the calls that need procKind
Let slProcName = olPane.CodeModule.ProcOfLine(llSRow, procKind) '
Let llLine1 = olPane.CodeModule.ProcBodyLine(slProcName, procKind) ' Get the procedure "start" line: the line on which the Declaration/Definition is for that procedure name, slProcName
Let llCountLines = olPane.CodeModule.ProcCountLines(slProcName, procKind) ' Get the count of lines in this procedure. In this case .....
Let llStartLine = olPane.CodeModule.ProcStartLine(slProcName, procKind) ' Get the start line of the procedure. In this case ...
Let llEndLine = llStartLine + llCountLines - 1 ' this we calculate
:whistling::reallyconfused:
Code:
Option Explicit
Sub DumDim()
For Cnt = 1 To 10
Next Cnt
Dim Cnt As Long
End Sub
Code:
Sub DumDim()
Dim Cnt As Long
For Cnt = 1 To 3
Dim Count As Long
Count = Count + 1
' count value will be 3
Next Cnt
MsgBox Prompt:=Count: Debug.Print Count
End Sub
This must be correct Time Format |
|
This must be Correct Date Format |
Worksheet: BluePrint
This must be correct Time Format |
|
This must be Correct Date Format |
Dim a! ' same as Dim a as Short
Dim b@ ' same as Dim b as Currency
Dim c# ' same as Dim c as Double
Dim d$ ' same as Dim d as String
Dim e% ' same as Dim e as Integer
Dim f& ' same as Dim f as Long
[Code]Dim a! ' same as Dim a as Short
Dim b@ ' same as Dim b as Currency
Dim c# ' same as Dim c as Double
Dim d$ ' same as Dim d as String
Dim e% ' same as Dim e as Integer
Code:
Dim strA As String, strB As String
Dim lA As Long, Lr As Long
' Or maybe this ???
Dim strA$, strB$
Dim lA&, Lr&
'
' https://bytes.com/topic/visual-basic/answers/643371-declaration-shortcuts
' https://stackoverflow.com/questions/28238292/declaring-variables-in-vba
' http://www.excelforum.com/excel-programming-vba-macros/1100751-excel-vba-to-copy-and-paste-from-horizontal-to-vertical-format-2.html#post4194972
' https://www.excelforum.com/excel-programming-vba-macros/1116127-avoiding-variants-multiple-declarations-per-line-assign-variants-to-all-but-last-variable.html#post4256569
Dim a! ' same as Dim a as Short
Dim b@ ' same as Dim b as Currency
Dim c# ' same as Dim c as Double
Dim d$ ' same as Dim d as String
Dim e% ' same as Dim e as Integer
Dim f& ' same as Dim f as Long
'
' https://bytes.com/topic/visual-basic...tion-shortcuts
' https://stackoverflow.com/questions/...riables-in-vba
' http://www.excelforum.com/excel-prog...ml#post4194972
' https://www.excelforum.com/excel-pro...ml#post4256569
Dim a! ' same as Dim a as Short
Dim b@ ' same as Dim b as Currency
Dim c# ' same as Dim c as Double
Dim d$ ' same as Dim d as String
Dim e% ' same as Dim e as Integer
Dim f& ' same as Dim f as Long
Code:
lnglProcCountLines, _
lnglModuleProcEndLine
Stop ' You got stopped - now go up there and do a bit of harvesting
' ***********************************************************************
End Sub
_____ Workbook: NeuProAktuelleMakros.xlsm ( Using Excel 2007 32 bit )
Row\Col |
F |
G |
39 |
|
|
40 |
µg |
% Empholen |
41 |
0 |
|
42 |
0 |
|
Worksheet: Leith2
Just testing HTML Tables for Email sending
This is just a test of HTML tables in support of this excelfox Thread
http://www.excelfox.com/forum/showthread.php/2253-Automatic-sort-due-date-and-send-email?p=10715#post10715
http://www.excelfox.com/forum/showth...0715#post10715
Posted in HTML code tags:
HTML Code:
<table width=811.5>
<col width=40>
<col width=103.5>
<col width=56.5>
<col width=71.5>
<col width=79>
<col width=57.5>
<col width=48.5>
<col width=77>
<col width=77>
<col width=80.5>
<col width=80.5>
<tr height=17>
<td>Machine EQ. ID</td>
<td style="background:#D8D8D8"> Manufacture </td>
<td>Model</td>
<td style="color:Black;background:#D8D8D8">Description</td>
<td>Serial Number</td>
<td style="background:#92D050">Weekly Date of Service</td>
<td style="background:#92D050">Weekly Next Service</td>
<td style="background:yellow">Monthly Date of Service</td>
<td style="background:yellow">Monthly Next Service</td>
<td style="background:#D8D8D8">Quarterly Date of Service</td>
<td style="background:#D8D8D8">Quarterly Next Service</td>
</tr></table>
Posted without HTML code tags:
<table width=811.5>
<col width=40>
<col width=103.5>
<col width=56.5>
<col width=71.5>
<col width=79>
<col width=57.5>
<col width=48.5>
<col width=77>
<col width=77>
<col width=80.5>
<col width=80.5>
<tr height=17>
<td>Machine EQ. ID</td>
<td style="background:#D8D8D8"> Manufacture </td>
<td>Model</td>
<td style="color:Black;background:#D8D8D8">Description </td>
<td>Serial Number</td>
<td style="background:#92D050">Weekly Date of Service</td>
<td style="background:#92D050">Weekly Next Service</td>
<td style="background:yellow">Monthly Date of Service</td>
<td style="background:yellow">Monthly Next Service</td>
<td style="background:#D8D8D8">Quarterly Date of Service</td>
<td style="background:#D8D8D8">Quarterly Next Service</td>
</tr></table>