
Sub CopiaTrovaSposta()
'
' CopiaTrovaSposta Macro
' Macro registrata il 29/07/14 da collaudi
'
For I = 1 To 85
Selection.HomeKey Unit:=wdLine
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Copy
Windows("2").Activate
Application.WindowState = wdWindowStateMaximize
Selection.Find.ClearFormatting
With Selection.Find
.Text = "C20"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Copy
Windows("1").Activate
Selection.EndKey Unit:=wdLine
Selection.PasteAndFormat (wdPasteDefault)
Next I
End Sub |
Sub CopiaTrovaSposta()
'
' CopiaTrovaSposta Macro
' Macro registrata il 29/07/14 da collaudi
'
For i = 1 To 85
Selection.HomeKey Unit:=wdLine
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Copy
Windows("2").Activate
Application.Move Left:=273, Top:=3
Windows("1").Activate
Windows("2").Activate
Application.Resize Width:=747, Height:=555
Application.Move Left:=65, Top:=3
Application.Resize Width:=955, Height:=555
Selection.Find.ClearFormatting
With Selection.Find
.Text = "C20 "
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Copy
Windows("1").Activate
Selection.Find.ClearFormatting
With Selection.Find
.Text = "C20 "
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.EndKey Unit:=wdLine
Selection.PasteAndFormat (wdPasteDefault)
Selection.TypeBackspace
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.HomeKey Unit:=wdLine
Next i
End Sub |
Sub Macro1()
Set wb = ThisWorkbook
LR = Cells(Rows.Count, "A").End(xlUp).Row
fname = "C:UsersuserDesktop2.txt" ' <<<<<<<<<<<< da modificare
Workbooks.OpenText Filename:=fname, Origin:= _
xlMSDOS, StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote _
, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:= _
False, Space:=False, Other:=True, OtherChar:="|", FieldInfo:=Array( _
Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), _
Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array(14, _
1), Array(15, 1), Array(16, 1), Array(17, 1)), TrailingMinusNumbers:=True
ActiveSheet.UsedRange.Copy wb.Sheets(2).Cells(1, 1)
ActiveWorkbook.Close False
Sheets(2).Range("B1, D1, M1").EntireColumn.Delete
With Sheets(2)
LR2 = .Cells(.Rows.Count, "A").End(xlUp).Row
For r = LR2 To 1 Step -1
s = RTrim(.Cells(r, 1).Value)
If Application.WorksheetFunction.CountIf(Sheets(1).Range("A1:A" & LR), RTrim(.Cells(r, 1).Value)) = 0 Then
.Rows(r).Delete
End If
Next
End With
End Sub
|
Sub Macro1()
Set wb = ThisWorkbook
LR = Cells(Rows.Count, "A").End(xlUp).Row
fname = "C:UsersuserDesktop2.txt" ' <<<<<<<<<<<< da modificare
Workbooks.OpenText Filename:=fname, Origin:= _
xlMSDOS, StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote _
, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:= _
False, Space:=False, Other:=True, OtherChar:="|", FieldInfo:=Array( _
Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), _
Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array(14, _
1), Array(15, 1), Array(16, 1), Array(17, 1)), TrailingMinusNumbers:=True
ActiveSheet.UsedRange.Copy wb.Sheets(2).Cells(1, 1)
ActiveWorkbook.Close False
Sheets(2).Range("B1, D1, M1").EntireColumn.Delete
With Sheets(2)
LR2 = .Cells(.Rows.Count, "A").End(xlUp).Row
For r = LR2 To 1 Step -1
s = RTrim(.Cells(r, 1).Value)
If Application.WorksheetFunction.CountIf(Sheets(1).Range("A1:A" & LR), RTrim(.Cells(r, 1).Value)) = 0 Then
.Rows(r).Delete
End If
Next
End With
End Sub
|
Sub a()
Set wb = ThisWorkbook
LR = Cells(Rows.Count, "A").End(xlUp).Row
fname = "C:UsersandreDesktop2.txt"
Workbooks.OpenText Filename:=fname
ActiveSheet.UsedRange.Copy wb.Sheets(2).Cells(1, 1)
ActiveWorkbook.Close False
With Sheets(2)
LR2 = .Cells(.Rows.Count, "A").End(xlUp).Row
For r = LR2 To 1 Step -1
p = InStr(.Cells(r, 1).Value, "|") - 2
s = Left(.Cells(r, 1).Value, p)
If Application.WorksheetFunction.CountIf(Sheets(1).Range("A1:A" & LR), s) = 0 Then
.Rows(r).Delete
End If
Next
End With
End Sub |
Sub Macro1()
Set wb = ThisWorkbook
LR = Cells(Rows.Count, "A").End(xlUp).Row
fname = "C:Documents and SettingssimoneDesktop2.txt"
Workbooks.OpenText Filename:=fname
ActiveSheet.UsedRange.Copy wb.Sheets(2).Cells(1, 1)
ActiveWorkbook.Close False
With Sheets(2)
LR2 = .Cells(.Rows.Count, "A").End(xlUp).Row
For r = LR2 To 1 Step -1
p = InStr(.Cells(r, 1).Value, "|") - 2
s = Left(.Cells(r, 1).Value, p)
If Application.WorksheetFunction.CountIf(Sheets(1).Range("A1:A" & LR), s) = 0 Then
.Rows(r).Delete
End If
Next
End With
End Sub
|
