how to prompt user to click on cell for starting import position

A

AlanN

How would this be changed so that when the macro is run, it prompts the user to click on the cell to start copying in the data?

Selection.TextToColumns Destination:=Range("A1"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(41, 1), Array(82, 1), Array(90, 1), Array(131, 1), _
Array(143, 1), Array(169, 1), Array(191, 1), Array(203, 1), Array(216, 1), Array(238, 1), _
Array(250, 1), Array(262, 1))


TIA, AlanN
 
H

Harald Staff

Hi Alan

Sub test()
Dim R As Range
On Error Resume Next
Set R = Application.InputBox("Click a cell", Type:=8)
If R Is Nothing Then Exit Sub
MsgBox R.Address 'replace with
'Selection.TextToColumns Destination:=R, and the rest as is
End Sub

--
HTH. Best wishes Harald
Excel MVP

Followup to newsgroup only please.

How would this be changed so that when the macro is run, it prompts the user to click on
the cell to start copying in the data?

Selection.TextToColumns Destination:=Range("A1"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(41, 1), Array(82, 1), Array(90, 1), Array(131,
1), _
Array(143, 1), Array(169, 1), Array(191, 1), Array(203, 1), Array(216, 1),
Array(238, 1), _
Array(250, 1), Array(262, 1))


TIA, AlanN
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top