Hi here is the code I've done so far:
Code:
Dim colIndex As Variant
colIndex = Application.InputBox("Enter a column that you want to add: ", "What column?")
If colIndex = "" Then Exit Sub
With ThisWorkbook.Sheets("Sheet1").Columns(colIndex) '<--| reference column you want to insert
.Insert shift:=xlRight
.Offset(, -2).Copy '<--| copy the column two columns to the left of the referenced one
.Offset(, -1).PasteSpecial xlPasteFormats '<--| paste formats to the new column
Application.CutCopyMode = False
End With
There is a table in my spreadsheet that has rows with different colors(2 colors gray and white that alternates in patterns), now the code above is implemented into a
button and when clicked ask the user where to add a column. The column is then generated but the colors for the rows is not there? Any ideas?
here is what it looks likes:
http://imgur.com/a/m04dt
Notice the
I column? All the way yo the right, with the the correct length and width but no colors.
Maybe someone can try out the code and see what it does?
The table sizes keeps changing so I don't think I can put a range in since I will have to manually change it once the table size changes?
I've tried implementing
Code:
.Offset(,-1).ColorIndex = .Offset(,-3).ColorIndex
but I am getting the same results, generated columns that have no color?