HDMI
06-19-2013, 02:40 PM
Hello forum,
I'm working with this macro to add and delete columns base on a number entered into a cell on another spreadsheet. Please see attachment template example and code.
On the example attachment on the "Employees" sheet there are numbered columns starting from 1 thru 6 at columns H. I need a macro that will add more columns or delete columns indicated by the number inputted in cell C9 on the "Monitoring Info" sheet. For instance I input the number 50 in the "Monitoring Info" sheet in cell C9 the "Employees" sheet will show starting from column H the number of columns 1 Thru 50.
The column will be incremented or diminish based on the user input on the Monitoring Info page cell C9. If the user input 5 into cell C9 then only 5 column will show numbered 1 through 5 starting at column H1 on the "Employee" sheet. If the user inputs 10 into cell C9 the number columns will show 1 thru10 starting at H1 on the Employee" sheet. etc, etc. I'm new to this forum I'm trying to learn all this and the people that know how to do this like yourself I think are very smart and intelligent and I hope to learn also. Thank you all once again.
Sub Columninput()
Dim MyRange As Object
' Store the selected range in a variable.
Set MyRange = Selection
' Select the entire column.
Selection.EntireColumn.Select
' Insert Columns in all selected sheets.
Selection.Insert
' Reselect the previously selected cells.
MyRange.Select
End Sub
I'm working with this macro to add and delete columns base on a number entered into a cell on another spreadsheet. Please see attachment template example and code.
On the example attachment on the "Employees" sheet there are numbered columns starting from 1 thru 6 at columns H. I need a macro that will add more columns or delete columns indicated by the number inputted in cell C9 on the "Monitoring Info" sheet. For instance I input the number 50 in the "Monitoring Info" sheet in cell C9 the "Employees" sheet will show starting from column H the number of columns 1 Thru 50.
The column will be incremented or diminish based on the user input on the Monitoring Info page cell C9. If the user input 5 into cell C9 then only 5 column will show numbered 1 through 5 starting at column H1 on the "Employee" sheet. If the user inputs 10 into cell C9 the number columns will show 1 thru10 starting at H1 on the Employee" sheet. etc, etc. I'm new to this forum I'm trying to learn all this and the people that know how to do this like yourself I think are very smart and intelligent and I hope to learn also. Thank you all once again.
Sub Columninput()
Dim MyRange As Object
' Store the selected range in a variable.
Set MyRange = Selection
' Select the entire column.
Selection.EntireColumn.Select
' Insert Columns in all selected sheets.
Selection.Insert
' Reselect the previously selected cells.
MyRange.Select
End Sub