Results 1 to 10 of 20

Thread: HTML Code Test --- post23344

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,521
    Rep Power
    10

    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()
    '
    Last edited by DocAElstein; 09-09-2023 at 09:49 AM.

Similar Threads

  1. Replies: 12
    Last Post: 09-22-2023, 03:53 PM
  2. HTML Code Test --post8798
    By DocAElstein in forum Test Area
    Replies: 19
    Last Post: 06-17-2018, 03:02 PM
  3. HTML Spreadsheet Test
    By DocAElstein in forum Test Area
    Replies: 3
    Last Post: 09-20-2014, 03:41 AM
  4. Code in HTML direct
    By DocAElstein in forum Test Area
    Replies: 0
    Last Post: 08-23-2014, 02:32 AM
  5. HTML and COde Tags again
    By DocAElstein in forum Test Area
    Replies: 0
    Last Post: 08-23-2014, 02:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •