Combining Macros

CalvT

New Member
Joined
Dec 9, 2013
Messages
21
Because Access doesn't support text to column, I've created a linked workbook. Now what I want is that when the workbook is opened, a macro is run automatically, then the workbook is closed and saved, also automatically.
The macros I have found are:

To run the macros
Code:
[COLOR=#333333]Private Sub Workbook_Open()[/COLOR]
[COLOR=#333333]Enter your macro here[/COLOR]
[COLOR=#333333]End Sub[/COLOR]

To split the text
Code:
Sub CopyAndSplit_IDEC1()  
Dim Words As Variant
  Words = Split(Sheets("Sheet2").Range("A1").Value)
  With Sheets("Sheet1").Range("A1").Resize(, UBound(Words) + 1)
    .Value = Words
    .Value = .Value
  End With
End Sub

To close the workbook
Code:
Private Sub CommandButton1_Click()    
   Application.DisplayAlerts = False
    With ThisWorkbook
        .Save
        .Close
        End With
    Application.DisplayAlerts = True
End Sub

Now I have two problems. One is that the macro to split the text only does one cell, I want it to do all the column if possible. The values are numbers separated by spaces. And the other problem is: how do I join them into one macro? Sorry to be so thick!
Thanks
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,223,909
Messages
6,175,314
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top