I have a column with a text in every cell to extract, in some way, in another column.
I make this vba script but doesn't work for apply the formula in another column for every cell, it make as a loop and i don't see nothing.
Sub CommandButtonClick()
Dim Addr As String
Addr = Range("E2:E") & Cells(Rows.Count,"E").End(xlUp).Row).Address
Range(Addr) = Evaluate("SUBSTITUTE(RIGHT(E2,LEN(E2)-
FIND("=>",E2)),CHAR(62),"")")
END Sub
And this to copy the result in another workbook:
Sub copyresult()
Dim x As Workbook
Dim y As Workbook
'## Open both workbooks first:
Set x = Workbooks.Open(" ticketsosurgenti ")
Set y = Workbooks.Open(" ticketsos ")
'Now, copy what you want from x:
x.Sheets("Sheet1").Range("C2:C").Copy
x.Sheets("Sheet1").Range("D2:D").Copy
'Now, paste to y worksheet:
y.Sheets("Sheet1").Range("A1:A").PasteSpecial
y.Sheets("Sheet1").Range("B1:B").PasteSpecial
'Close x:
x.Close
End Sub
For the copying and pasting between workbooks, the following should help:
Sub copyresult()
Dim x As Workbook
Dim y As Workbook
Dim LastRow As Long
'## Open both workbooks first:
Set x = Workbooks.Open("C:/ticketsosurgenti.xlsx")
Set y = Workbooks.Open("C:/ticketsos.xlsx")
'above amend the path and filename of both your workbooks
Dim wsX As Worksheet: Set wsX = x.Sheets("Sheet1")
Dim wsY As Worksheet: Set wsY = y.Sheets("Sheet1")
LastRow = wsX.Cells(wsX.Rows.Count, "A").End(xlUp).Row
'get the last row with data on Column A on Sheet x
wsX.Range("C2:C" & LastRow).Copy
wsY.Range("A1").PasteSpecial xlPasteAll
wsX.Range("D2:D" & LastRow).Copy
wsY.Range("B1").PasteSpecial xlPasteAll
x.Close
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.