
Sub Impfiletxt()
FileDaAprire = Application.GetOpenFilename("Text Files (*.txt), *.txt")
If FileDaAprire = False Then Exit Sub
Dove = InputBox("SCRIVI L'INDIRIZZO DELLA CELLA DA DOVE INIZIARE A IMPORTARE")
If Dove = "" Then Exit Sub
With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & FileDaAprire & "", Destination:=Range(Dove))
.Refresh BackgroundQuery:=False
End With
End Sub
|
Sub Impfiletxt()
FileDaAprire = Application.GetOpenFilename("Text Files (*.txt), *.txt")
If FileDaAprire = False Then Exit Sub
Dove = InputBox("SCRIVI L'INDIRIZZO DELLA CELLA DA DOVE INIZIARE A IMPORTARE")
If Dove = "" Then Exit Sub
With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & FileDaAprire & "", Destination:=Range(Dove))
.Refresh BackgroundQuery:=False
End With
End Sub
|
FileDaAprire = Application.GetOpenFilename("Text Files (*.txt), *.txt")
If FileDaAprire = False Then Exit Sub
dove = InputBox("SCRIVI L'INDIRIZZO DELLA CELLA DA DOVE INIZIARE A IMPORTARE")
If dove = "" Then Exit Sub
With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & FileDaAprire & "", Destination:=Range(dove))
.Refresh BackgroundQuery:=False
End With
''''''''''''''''
Application.ScreenUpdating = False
Range(dove).Select
Selection.End(xlDown).Select
ActiveCell.FormulaR1C1 = "=ADDRESS(ROW(), COLUMN(), 4)"
FINE = ActiveCell.Value
ActiveCell.Value = ""
conta = Application.WorksheetFunction.CountIf(Range(dove & ":" & FINE), "k")
For i = 1 To conta
Range(dove).Select
If ActiveCell.Value = "" Then
Do
ActiveCell.Offset(1).Select
Loop Until ActiveCell.Value <> ""
End If
x = ActiveCell.Address
Do
ActiveCell.Offset(1).Select
Loop Until ActiveCell.Value = "k"
Y = ActiveCell.Address
Range(x & ":" & Y).Select
Selection.Cut
Range(dove).Select
Do
ActiveCell.Offset(0, 1).Select
Loop Until ActiveCell.Value = ""
ActiveSheet.Paste
Next i
Range(dove & ":" & FINE).Select
Selection.Delete Shift:=xlToLeft
Application.ScreenUpdating = True
Range(dove).Select
|
Sub Impfiletxt()
FileDaAprire = Application.GetOpenFilename("Text Files (*.txt), *.txt")
If FileDaAprire = False Then Exit Sub
dove = InputBox("SCRIVI L'INDIRIZZO DELLA CELLA DA DOVE INIZIARE A IMPORTARE")
If dove = "" Then Exit Sub
With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & FileDaAprire & "", Destination:=Range(dove))
.Refresh BackgroundQuery:=False
End With
Application.ScreenUpdating = False
Range(dove).Select
Selection.End(xlDown).Select
ActiveCell.FormulaR1C1 = "=ADDRESS(ROW(), COLUMN(), 4)"
FINE = ActiveCell.Value
ActiveCell.Value = ""
conta = Application.WorksheetFunction.CountIf(Range(dove & ":" & FINE), "k")
For i = 1 To conta
Range(dove).Select
If ActiveCell.Value = "" Then
Do
ActiveCell.Offset(1).Select
Loop Until ActiveCell.Value <> ""
End If
x = ActiveCell.Address
Do
ActiveCell.Offset(1).Select '<<<<<<<<< ERRORE
Loop Until ActiveCell.Value = "k"
Y = ActiveCell.Address
Range(x & ":" & Y).Select
Selection.Cut
Range(dove).Select
Do
ActiveCell.Offset(0, 1).Select
Loop Until ActiveCell.Value = ""
ActiveSheet.Paste
Next i
Range(dove & ":" & FINE).Select
Selection.Delete Shift:=xlToLeft
Application.ScreenUpdating = True
Range(dove).Select
End Sub |
FileDaAprire = Application.GetOpenFilename("Text Files (*.txt), *.txt")
If FileDaAprire = False Then Exit Sub
dove = InputBox("SCRIVI L'INDIRIZZO DELLA CELLA DA DOVE INIZIARE A IMPORTARE")
If dove = "" Then Exit Sub
With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & FileDaAprire & "", Destination:=Range(dove))
.Refresh BackgroundQuery:=False
End With
Application.ScreenUpdating = False
Range(dove).Select
Selection.End(xlDown).Select
ActiveCell.FormulaR1C1 = "=ADDRESS(ROW(), COLUMN(), 4)"
FINE = ActiveCell.Value
ActiveCell.Value = ""
''''''''''''''''''''''''''''''''''''''''
Range(dove).Select
valore = Trim(ActiveCell.Value)
ActiveCell.Value = valore
Do
ActiveCell.Offset(1).Select
valore = Trim(ActiveCell.Value)
ActiveCell.Value = valore
Loop Until ActiveCell.Value = ""
''''''''''''''''''''''''''''''''''''''''
conta = Application.WorksheetFunction.CountIf(Range(dove & ":" & FINE), "k")
For i = 1 To conta
Range(dove).Select
If ActiveCell.Value = "" Then
Do
ActiveCell.Offset(1).Select
Loop Until ActiveCell.Value <> ""
End If
x = ActiveCell.Address
Do
ActiveCell.Offset(1).Select
Loop Until ActiveCell.Value = "k"
Y = ActiveCell.Address
Range(x & ":" & Y).Select
Selection.Cut
Range(dove).Select
Do
ActiveCell.Offset(0, 1).Select
Loop Until ActiveCell.Value = ""
ActiveSheet.Paste
Next i
Range(dove & ":" & FINE).Select
Selection.Delete Shift:=xlToLeft
Application.ScreenUpdating = True
Range(dove).Select
|
