Question : Excel - macro to delete a column needed

Hi,

I need an Excel macro that will simply delete and remove an entire column from a spreadsheet.  

I don't know Excel or programming, so I would prefer a simple interface like provided in my last posted question here:
http://www.experts-exchange.com/Applications/MS_Office/Excel/Q_20785580.html

I also would like a macro that will combine two columns into one.
For example if I have 3 columns:
Mary   Ann    Tom
Billy    Joe      Ed
The results of the macro, if I combine column A and B would be 4 columns:
Mary Ann      Mary   Ann    Tom
Billy Joe        Billy    Joe      Ed

Thank you for your help.

Steve

Answer : Excel - macro to delete a column needed

Hi Steve234,
Here is a macro to combine two columns:
Sub MergeMe()
'Merges the contents of two columns
Dim rg As Range
Dim ColumnDelete As String
Dim myData As Variant, temp As Variant
Dim i As Long, j As Long, k As Long, nRowEnd As Long, nRowStart As Long
temp = InputBox("Enter the first column whose contents you want to merge", Default:="A")
If IsNumeric(temp) Then
    j = CLng(temp)
Else
    j = Cells(1, temp).Column
End If
temp = InputBox("Enter the second column whose contents you want to merge", Default:="A")
If IsNumeric(temp) Then
    k = CLng(temp)
Else
    k = Cells(1, temp).Column
End If
ColumnDelete = InputBox("Do you want to delete the second column after the merge?", Default:="No")
Set rg = ActiveSheet.UsedRange
myData = rg.Value
nRowStart = InputBox("Enter the starting row", Default:=1)
nRowEnd = InputBox("Enter the ending row", Default:=rg.Rows.Count)
For i = nRowStart To nRowEnd
    myData(i, j) = myData(i, j) & myData(i, k)
Next i
rg.Value = myData
If Left(LCase(ColumnDelete), 1) = "y" Then Columns(k).Delete
End Sub

Cheers!

Brad
Random Solutions  
 
programming4us programming4us