VBA Mail Merge - - Excel VBA Training - - Anaylsis - -Excel.Tips - - Speadsheet Guru(PW=TSG) - All about tables

Excel


Check boxes

- Clear the box using a macro


Like Do loop but For Next will loop the number of time you want it to. So you want a do loop to look exactly 5 time. Here is the code.



Sub DBFill()
Dim I

    Range("A4").Select
    Selection.End(xlDown).Select
    ActiveCell.Offset(0, 13).Range("A1").Select
    Range(Selection, Selection.End(xlUp)).Select
    Selection.FillDown

For I = 1 To 5 (this section will loop 5 times)
    Selection.End(xlDown).Select
    ActiveCell.Offset(0, 1).Range("A1").Select
    Range(Selection, Selection.End(xlUp)).Select
    Selection.FillDown
Next I


End Sub




Fill blank cells in column with the word "Blank" to the end of the data in that column using a DO Loop

Application.ScreenUpdating = False
Sheets("DB").Select
Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 2).Range("A1").Select
ActiveCell.Value = "STOP"

Range("C1").Select

Selection.End(xlDown).Select

Do

If ActiveCell.Value = "" Then ActiveCell.Value = "Blank"
ActiveCell.Offset(-1, 0).Range("A1").Select
Selection.End(xlDown).Select
If ActiveCell.Value = "STOP" Then Exit Do
ActiveCell.Offset(1, 0).Range("A1").Select

Loop

ActiveCell.ClearContents



Open email from excel in Internet Explorer

    First Activate the following two items by clicking on Tools tab and then ‘References…’: in the VBA editor.
       •Microsoft Internet Controls
       •Microsoft HTML Object Library



Dim HTML As HTMLDocument
Dim MyBrowser As InternetExplorer
Sub webyahoo()

Dim MyHTML_Element As IHTMLElement
Dim MyURL As String
On Error GoTo Err_Clear
MyURL = "https://login.yahoo.com/config/login?.src=fpctx&.intl=us&.lang=en-US&.done=https%3A%2F%2Fwww.yahoo.com"
Set MyBrowser = New InternetExplorer
MyBrowser.Silent = True
MyBrowser.navigate MyURL
MyBrowser.Visible = True

Do
Loop Until MyBrowser.readyState = READYSTATE_COMPLETE
Set HTMLDoc = MyBrowser.document

HTMLDoc.all.UserName.Value = "dcarp761@yahoo.com" 'Enter your email id here
HTMLDoc.all.passwd.Value = "your real pw goes here" 'Enter your password here

For Each MyHTML_Element In HTMLDoc.getElementsByTagName(“input”)
If MyHTML_Element.Type = “submit” Then MyHTML_Element.Click: Exit For
Next
Err_Clear:
If Err <> 0 Then
Err.Clear
Resume Next
End If
End Sub



=MAX - This is like saying Maxifs. Yet Maxifs does not exist.

{=MAX(IF($O:$O=$T74,IF($P:$P=$AD$2,IF($R:$R=W$1,$K:$K))))}
{=MAX(IF(Range=Cell,IF(Range=Cell,Range=Cell,Range where the max data is located.}



Get and open all available ".txt" files from a folder in excel

http://stackoverflow.com/questions/15299254/excel-vba-import-folder-of-txt-tab-delimted-files-into-next-available-row








Two or more lists opened by a single Category list.


Now the macro that drive it.



Changing a cell from seconds to h:mm:ss format

1




Changing the month

Here we will use the spin button located on the developer tab.
spin Click on the spin button and place on page.
Now right click and Format Control. If this is changing the month set min
to 1 and max to 12.
spinbutton
Cell link is the cell that will change value.
We can now use a IF statment to change months based on the value of (F1).

In the cell you want the month to apprear use this as an example:

=IF(F1=1,"January",IF(F1=2,"February",IF(F1=3,"March",IF(F1=4,"April",
IF(F1=5,"May",IF(F1=6,"June",IF(F1=7,"July",IF(F1=8,"August", IF(F1=9,"September",
IF(F1=10,"October",IF(F1=11,"November",IF(F1=12,"December",Error))))))))))))








Advanced Filtering

This example teaches you how to apply an advanced filter to only display records that meet complex criteria.

When you use the Advanced Filter, you need to enter the criteria on the worksheet. Create a Criteria range(blue border below for illustration only) above your data set. Use the same column headers. Be sure there's at least one blank row between your Criteria range and data set.

And Criteria

To display the sales in the USA and in Qtr 4, execute the following steps.

1. Enter the criteria shown below on the worksheet.

2. Click any single cell inside the data set.

3. On the Data tab, in the Sort & Filter group, click Advanced.

4. Click in the Criteria range box and select the range A1:D2 (blue).

5. Click OK.

Now control this with a macro button. Notice the options to copy your filtered data set to another location and display unique records only (if your data set contains duplicates).

Result.





Descripition: End Down & Color cell Green

This will go to a cell location and type a word in the cell.

Application.Goto Reference:="R1C27"
ActiveCell.FormulaR1C1 = "lunch break"
ActiveCell.FormulaR1C1 = "=LEFT(RC[-4],5)"    ( This says =left(Cell,5) or =Left(4cells to the left of the active cell,5) and 5 represents the number of digits to display. )

Adding a Formula in a cell using a macro

ActiveCell.Formula = "=if(A2=A1,0,""X"")"
ActiveCell.FormulaR1C1 = "=Trim(RC[1])"     If this formula was in cell "A1" it would Trim 1 cell to the right. neg -1 would trim on cell to the left.


The types of variables

Name Type Details Symbol
Byte Numerical Whole number between 0 and 255.
Integer Numerical Whole number between -32'768 and 32'767. %
Long Numerical Whole number between - 2'147'483'648 and 2'147'483'647. &
Currency Numerical Fixed decimal number between -922'337'203'685'477.5808 and 922'337'203'685'477.5807. @
Single Numerical Floating decimal number between -3.402823E38 and 3.402823E38. !
Double Numerical Floating decimal number between -1.79769313486232D308 and 1.79769313486232D308. #
String Text Text. $
Date Date Date and time.
Boolean Boolean True or False.
Object Object Microsoft Object.
Variant Any type Any kind of data (default type if the variable is not declared).




Excel VBA App stops spontaneously with message “Code execution has been halted”

Press "Debug" button in the popup.
Press Ctrl+Pause|Break twice.
Hit the play button to continue.
Save the file after completion.
Hope this helps someone.



Create a drop down menu using Combo Box Control form. Assign Z1 to the number and the list from where ever you made it.

Sub Email_DB()
Sheets("Email_DB").Select
End Sub

Sub Email_CSS()
Sheets("Email_CSS").Select
End Sub

Sub SM_DB()
Sheets("SM_DB").Select
End Sub

Sub Databank()
Sheets("Databank").Select
End Sub

Sub phone()
Sheets("phone").Select
End Sub



Sub Worksheet_Change()


If Range("Z1").Value = "2" Then
Call Trace
End If

If Range("Z1").Value = "3" Then
Call Days
End If

If Range("Z1").Value = "4" Then
Call Email_DB
End If

If Range("Z1").Value = "5" Then
Call SM_DB
End If

If Range("Z1").Value = "6" Then
Call Databank
End If

If Range("Z1").Value = "7" Then
Call phone
End If

End Sub






This is finding 2 word "Audio" or "All" in cell "G6" and will output either Yes it true or nothing "" if False.
=IF(OR(ISNUMBER(SEARCH("Audio",G6)),ISNUMBER(SEARCH("All",G6))),"Yes","")


Find a word in the middle of text in a cell This would go in cell B1. Looking at cell A1.
=mid(A1,FIND("this",A5)+1,6)

Macro Examples:

Macro "Function": ... Just as =Sum(A1+5) is a function that adds 5 to cell A1. This sum function would be written in a macro as:
Function plusfive (addfive As Variant)
   plusfive = addfive + 5
End function

Explanation:
The "Function name" = "plusfive"
(addfive As Variant ) ..... ( As Variant use the following operators: ( + - * / ))
"plusfive" calls the function "addfive" or the action of the variant "+ 5" to the cell A1.
End Function (ends the function)

Here we see in cell C1 that 5 has been subtracted from cell A1 using the ( - ) operator.


The words "plusfive" and "addfive" can be anything you want them to be. They are variables that you choose.

Here we are adding 2 cells using the Function macro.
Function salesfigures(Sales As Variant, Plus As Variant)
salesfigures = Plus + Sales
End Function





Fill Down

Sub NorthAmerica()
'
' NorthAmerica Macro
'

'
Range("BF3").Select

Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveCell.FormulaR1C1 = "North"

ActiveCell.Offset(0, -4).Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 4).Range("A1").Select
Range(Selection, Selection.End(xlUp)).Select
Selection.FillDown

End Sub




Here is another example of fill down in a macro

Sub DateFillDown()
'
' DateFillDown Macro
'

'
'Application.ScreenUpdating = False
Range("G1").Select
Selection.Copy
Range("H1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.Copy
Range("D1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Sheets("Sheet1").Paste
Selection.Copy
Do

ActiveCell.Offset(1, -1).Range("A1").Select
If ActiveCell.Value = "" Then Exit Do
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.Paste

Loop

Application.CutCopyMode = False
ActiveWorkbook.Save

End Sub




Auto_Open - This macro will run when the worksheet is opened.
Sub Auto_Open()
'
' auto_open Macro
Content
Content

End Sub


Auto Close

Sub auto_close()
Sheets("sheets1").Select
ActiveWorkbook.Save
End Sub



This will Auto Open and place a picture on the sheet. Easter Egg


Sort using custom list.

Say you want to sort by North East South West.
If you sort A to Z on the data tab East would come first, but we want the data sorted by North first.
This is where we make a custom list. Click File / Options / Advanced / Scroll to bottom of page and click "Edit Custom List..." button.
Type in your custom sort list.

Click OK
Click OK to exit.



Now sort by custom list.
Example:    
Unsorted Sorted A-Z Custom Sort









Prevent a formula from displaying in the formula bar

    Select the range of cells whose formulas you want to hide. You can also select nonadjacent ranges or the entire sheet.

    On the Home tab, in the Cells group, click Format, and then click Format Cells.

    In the Format Cells dialog box, on the Protection tab, select the Hidden check box.
    Click OK.

    On the Review tab, in the Changes group, click Protect Sheet.
    Make sure the Protect worksheet and contents of locked cells check box is selected, and then click OK.





Add and or Hide a shape using a toggle button macro


Add a shape like an arrow. Then find its name by clicking on it. Make a macro. Change the name in the macro to match the shape you want to toggle.


Stacking Lists – Using a Macro with a Form Control. Also see Validate.



Moving Data /Delete old data/ Adding Cell color




Sheets("Sheet3").Select
Range("A1").Select

Do
If ActiveCell.Value = "" Then Exit Do
ActiveCell.Offset(1, 0).Activate
Loop
ActiveSheet.Paste
Application.CutCopyMode = False
Range(“A1”).Select



Do
If ActiveCell.Value = "" Then Exit Do
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(1, -1).Range("A1").Select
Loop

Application.CutCopyMode = False
[a1].Select

End Sub
Do until IsEmpty (Activecell)
Selection.Font.Bold = True
Activecell.Offset(3, 0).Range(A1:A3).Select

Loop


Description: Using a Macro like a form and database.







Select current row range
Do
If ActiveCell.Value <> "FV" Then ActiveCell.Offset(1, 0).Range("A1").Select
If ActiveCell.Value = "" Then Exit Do

If ActiveCell.Value = "FV" Then
ActiveSheet.Range("B" & ActiveCell.Row & ":J" & ActiveCell.Row).Copy ' this will select the current row range from column "B" to
ActiveCell.Offset(0, 2).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(1, -2).Range("A1").Select
End If


Loop

Descripition: Open another workbook with a macro. 2 step process

Open a Word Doc from Excel


Here is another way to do it. This one worked better. Delete Active row Rows(ActiveCell.Row).Delete
Example: If ActiveCell.Value = "" Then Rows(ActiveCell.Row).Delete




Delete a row from a list on "TAB" "List" matching cell M8.
Do
If ActiveCell.Value = ActiveWorkbook.Worksheets("List").Range("M8") Then
Rows(ActiveCell.row).Delete
ActiveCell.Offset(-1, 0).Select
End If

If ActiveCell.Value = "" Then Exit Do
Loop



Delete a row based on criteria

Here is another example of how we can delete a row based on criteria

Sub Prep_DeleteSE()
'
' Prep_DeleteSE Macro
'

'
Range("B2").Select

End Sub



Pointing to a different sheet inside a macro.
ActiveWorkbook.Worksheets("KCRM_DB")




Stepping thru a macro line by line



Convert a column of text to numbers. This will convert the numbers that are displayed as Text in Column "E" to numbers.

Adding a wait state to the macro.
Formula's

Conditional Formatting
Changing the color of every 5th row
Every other row is a different color
Highlight the cells you want to show with alternating colored rows and apply this conditional formating.


Counting the number of items in a column with out counting duplicates.


Converting from Hexadecimal to RGB in Excel




How to combine cells of information.


Delete controls on a worksheet.


Filtering columns


Data Tab / Text to column function


Auto Resize a column or columns:


Remove Duplicates


Format painter / Quickly copy formats to other cells


Adding Weekdays / Months / Number lists / Dates or Custom lists in a column or row.


Shortcut for repetitive typing


The Ribbon


Adding a drop down menu.


Keyboard Commands
Page break lines
Get rid of the page break lines. Click: File / Options / Advanced. Scroll to "Display options for this worksheet" uncheck "Show Page Breaks"




Where does a cell gets its data?





Which Cells have Formula's



Sumifs with multiple criteria

Charts




Entering data into more than one cell using Ctrl + Enter



Keyboard Tricks and Tips




Current time

Macro delivers current time to Cell A1
In cell B1 type 1:00
In cell C1 type "=A1+B1" This will give you a range of current time plus one hour for tracking lunch times as an example.


Top of page
Record a macro using these steps.


Cell Speak,

right click on the quick reference bar and choose "More Commands". Choose "Commands not in the ribbon" "Speak Cell on Enter".
To make a cell talk using a macro:

Sub hello()
'
' hello Macro

Range("AA1").Speak

End Sub
......(What ever text is typed in Cell AA1 will be spoken when the macro is activated)



=int(cell)
Integer: This will separate the Date time cell into only the Date. Time becomes 0.



Unique: Count the number of unique records in column "F". The range should be all the item in the column and not the entire column itself.
We would not want to use F:F,F:F
F1:F10,F1:F10 would be a valid range.



Transpose will transpose the data and keep the data current with from the where it was transposed from.
Hi-light the area that you want to transpose and find the row and column name while it is hi-lighted.


Next hi-light the new area with the opposite range. While still hi-lighted write the formula: =TRANSPOSE(A1:M6) Shift +Ctrl+Enter {=TRANSPOSE(A1:M6)}



{=TRANSPOSE(A1:M6)} will produce:





Getting Data from inside a cell.
Find All Character to the Right of Left of the colon ,
This formula will replace Lines 18 and 19 below in the picture.
Line 18: =Left(A18,Len(A18),Find(",",A18)
Line 19: =Right(A18,Len(A18),Find(",",A18)




Find a word in the middle of text in a cell This would go in cell B1. Looking at cell A1.
=mid(A1,FIND("this",A5)+1,6)




Find text in the middle of a string of text in a cell.



I used this to find EU, FV,TW in the string SSDFV1234123 The formula displayed FV.

Get the number 1 from this date 12/1/2014 which is located in Cell A1 Formula: =Day(A1)



Proper

=Proper(A1) Proper will capitolize the letters so that: dan carpenter would be Dan Carpenter
=Trim(A1) Trim will remove extra spaces in front or at end or double spaces between letters
=Proper(Trim(A1) Combine these to make a list of name consistant and easier to read.
Results are shown in Column "B"





Moving the minus sign to the correct side of the number.





This will go to a sheet thats name is in cell A1 on Sheet "Dan" So this gives us a way to goto another sheet using a single cell which is now a variable.

Sub DoIt()
Dim strSheet As String

strSheet = Sheets("Dan").Range("A1")
Sheets(strSheet).Activate
End Sub





=indirect(celladdress "&" something) Very simalar to concatenating two cell reference.
This will display a cell reference from multiple sheets tabs. Lets say you have 4 sheets named North, South, East, West. The total on each of these tab is located in cell C1.
From the home page you have listed from Cell A3 down North, South, East, West. In Cell C3 insert the indirect formula which will pull the content of cell C1 from these 4 sheets.





Colors and Pictures

Themes, On the Page Layout tab choose themes. This will reset the main color palate.

Pictures, From the insert tab insert a picture. Now click on the picture. On the Picture Tools Format tab click on remove background. Check out all the other things you can do.





Custom Date Formats



Top

1. Click on the Developer tab, Click on Visual Basic, click on the sheet that you are add the macro too (See example below). Write the following macro. Save.

  Private Sub Worksheet_Change(ByVal Target As Range)
' If Not Intersect(Target, Range("H12:H14")) Is Nothing Then
lRed = Abs(Range("H12").Value) Mod 256
lGreen = Abs(Range("H13").Value) Mod 256
lBlue = Abs(Range("H14").Value) Mod 256

Range("K12").Interior.Color = RGB(lRed, lGreen, lBlue)
' End If
End Sub
 

Example:




Delete Last Row of data on a sheet.

Sub KCRM_Del_LastRow()
'
' KCRM_Del_LastRow Macro
'
Application.Goto Reference:="R1C2"

'
Application.Goto Reference:="R65536C2"
Range("b65536").End(xlUp).Select
Selection.EntireRow.Delete

End Sub


Change a negative value to a positive value.
=abs(Cell)




Calculate the number of days between two dates

A
Date
6/8/2007
6/20/2007
Formula Description
=A3-A2 Days between the two dates (12)
=NETWORKDAYS(A2,A3) Weekdays between the two dates (9)

 NOTE    To view the dates as numbers, select the cell and click Cells on the Format menu. Click the Number tab, and then click Number in the Category box.




Convert a cell which represents sec to min. Cell A1 with formula in B1 which will result in C1.
  A B C Note that Column C needs to be formatted . - - - Custom / mm:ss
1 120 =A1/86400 02:00  
2        
3 Seconds Formula Result  





This macro will clear all filters on a worksheet.

  Sub clearfilters()
'
' clearfilters Macro
ActiveSheet.ShowAllData
'
End Sub
   
This will remove or clear a filter from a specific column in this case column 2 (field 2)
 

Sub RemoveFilter()
'
Dim str As String

strAddress = ActiveCell.CurrentRegion.Address

ActiveSheet.Range(strAddress).AutoFilter Field:=2

End Sub







CMS - Logon and Logoff Times for CMS Trace Report. The problem is that for one date you can have multiple logon and logoffs. The problem is how do you get to the last Logoff while skipping other Logoff in the same day. Look at the picture in this example we have a logon on 1-1-2015 at time 230. At 238 the agent logged off and back in again at 239. Final logoff for the was 263.


He is how we acommplish this problem.
1. Cells A:C are raw data from CMS.
2. Click on the Developer Tab / Insert / Combo box.
3. Combo box RT click and choose "Format Controls". Input range, choose from (List Tab) columns A & B. Column "A" will be Ascending numbers 1 2 3 and so on.
Column "B" will be dates.
4. Combo box RT click and choose "Format Controls". Cell link, choose "T1". And drop down line change to 10.
5. Cell F1 will contain this formula: {=INDEX(list!C:D,MATCH(T1,list!C:C,0)+0,2)} Which will fetch the data needed. This formula will need curly braces dont forget to add them.
6. The Combo box also needs a Macro assigned to it.
Sub logonlogoff_two()
'
' logonlogoff_two Macro
'

'
Columns("A:C").Select
Selection.Copy
Range("M1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWorkbook.Worksheets("Home").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Home").Sort.SortFields.Add Key:=Range("M2:M47"), _
SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Home").Sort.SortFields.Add Key:=Range("N2:N47"), _
SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Home").Sort
.SetRange Range("M1:O47")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A1").Select
End Sub
This macro will take the data from coluimns A : C and copy it to column "M:O" then sort "M:O" by Date and Time Oldest to Newest and Time highest to lowest. This should completely reverse columns A:C.

Logon Date Cell H2 contains the formula: {=INDEX(A:C,MATCH(F1&H1,A:A&C:C,0)+0,2)}

Logoff Date Cell J2 contains the formula: {=INDEX(M:O,MATCH(F1&J1,M:M&O:O,0)+0,2)}

To see this example go to lotus notes archive and seach for email dcarp1 on 1/10/2015 A working example is in this email. Subject: Login and logout times solved



Sub T1down()
'
' T1down Macro
'

'
ActiveSheet.Range("T1", ActiveSheet.Range("T1").End(xlDown)).Select
Selection.Copy

End Sub

'(This will select column "T" dynamically and then copy.)


Here is another example"
Sub clearcolumn()

ActiveSheet.Range("G2", ActiveSheet.Range("G2").End(xlDown)).Select
Selection.Clear

End Sub






Sub step_A()
'
' step_A Macro
'

'
Application.ScreenUpdating = False
ActiveSheet.Range("E2", ActiveSheet.Range("E2").End(xlDown)).Select
Selection.Clear


Range("A1").CurrentRegion.Select
Selection.Copy
Range("E1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWorkbook.Worksheets("db").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("db").Sort.SortFields.Add Key:=Range("E2") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("db").Sort
.SetRange Range("E1").CurrentRegion
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveSheet.Range("$E$1").CurrentRegion.RemoveDuplicates Columns:=Array(1, 3), Header _
:=xlYes
Range("D1").Select
End Sub



This will remove character from text or numbers. Example Cell A1 contains "(" or ")" or "-" from a phone number.
=SUBSTITUTE(A1,"(","") ... ... This will replace one character the "(" with "" nothing. The nice thing here is that you can nest substitute like this
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"(",""),")","")," ",""),"-","") . . . Using this formula changes this (800) 123-4567 to 8001234567





Top
Here are some VBA commands when using a macro. See more here.
Select VBA Coding
Entire Table ActiveSheet.ListObjects("Table1").Range.Select
Table Header Row ActiveSheet.ListObjects("Table1").HeaderRowRange.Select
Table Data ActiveSheet.ListObjects("Table1").DataBodyRange.Select
Third Column ActiveSheet.ListObjects("Table1").ListColumns(3).Range.Select
Third Column (Data Only) ActiveSheet.ListObjects("Table1").ListColumns(3).DataBodyRange.Select
Select Row 4 of Table Data ActiveSheet.ListObjects("Table1").ListRows(4).Range.Select
Select 3rd Heading ActiveSheet.ListObjects("Table1").HeaderRowRange(3).Select
Select Data point in Row 3, Column 2 ActiveSheet.ListObjects("Table1").DataBodyRange(3, 2).Select
Subtotals ActiveSheet.ListObjects("Table1").TotalsRowRange.Select

Inserting Rows and Columns Into The Table

Select VBA Coding
Insert A New Column 4 ActiveSheet.ListObjects("Table1").ListColumns.Add Position:=4
Insert Column at End of Table ActiveSheet.ListObjects("Table1").ListColumns.Add
Insert Row Above Row 5 ActiveSheet.ListObjects("Table1").ListRows.Add (5)
Add Row To Bottom of Table ActiveSheet.ListObjects("Table1").ListRows.Add AlwaysInsert:= True
Add Totals Row ActiveSheet.ListObjects("Table1").ShowTotals = True


Choosing a table header and column
Range("Table1,[[#Header] , [Status]]").Select


Copy a table rows using VBA

Sub Selectmem()

ActiveSheet.ListObjects("Table2").ListRows(ActiveCell.Row).Range.Select

End Sub



' Offset Columns and or ROWS using a cell reference rather than a static number.
Application.ScreenUpdating = False
Range("A1").Select
Range("A1").Offset(0, [T2]).Select ' Notice the offset = 0 rows and a cell reference [T2] for the number of columns.
ActiveCell.EntireColumn.Copy ' Now that the column is found, VBA then copies the active column.
Range("AC1").Select
ActiveSheet.Paste


Selecting a Column or Row
ActiveCell.EntireColumn.Select
ActiveCell.EntireRow.Select
or
Selection.EntireColumn.Select
Selection.EntireRow.Select






Get rid of those page break lines.

Dynamic Ranges Auto range a column