K0st4din
Well-known Member
- Joined
- Feb 8, 2012
- Messages
- 501
- Office Version
- 2016
- 2013
- 2011
- 2010
- 2007
- Platform
- Windows
Hello, after a while, I need some help from you.
This macro is written by you, and to this day it helps me a lot.
Every time I open the table and press the button I remember you and your help.
Please for your help, if it is possible to help me change the macro a bit.
Ie to work the same way - to take the information from sheet1 but to transfer the information to a specific sheet, for example in a sheet called "Peaches"
If you have questions, I am at your disposal.
Thank you in advance
This macro is written by you, and to this day it helps me a lot.
Every time I open the table and press the button I remember you and your help.
Please for your help, if it is possible to help me change the macro a bit.
Ie to work the same way - to take the information from sheet1 but to transfer the information to a specific sheet, for example in a sheet called "Peaches"
If you have questions, I am at your disposal.
Thank you in advance
Code:
Private Sub CommandButton4_Click()
Dim x As Long, Cell As Range, CellText As String, ws As Worksheet
Dim Words As Variant, Replacements As Variant
Const TableSheetName As String = "Sheet1"
Application.Volatile
Words = Sheets(TableSheetName).Range("V2", Sheets(TableSheetName).Cells(Rows.Count, "V").End(xlUp))
Replacements = Sheets(TableSheetName).Range("W2", Sheets(TableSheetName).Cells(Rows.Count, "W").End(xlUp))
For Each ws In Worksheets 'I think something needs to be changed here to not list all the sheets, but I'm not sure
lTotalRows = ws.Range("J2", ws.Cells(Rows.Count, "J").End(xlUp)).Rows.Count
For Each Cell In ws.Range("J2", ws.Cells(Rows.Count, "J").End(xlUp))
'ProgressBar2.Value = Int(100 * (Cell.Row - 1) / lTotalRows)
DoEvents
CellText = ""
For x = 1 To UBound(Words)
If InStr(1, Cell.Value, Words(x, 1), vbTextCompare) Then CellText = CellText & "+" & Replacements(x, 1) 'If Cell.Value = Words(X, 1)
Next
Cell.Offset(, 6).Value = Mid(CellText, 2) 'PARI P
Next
Next
'ProgressBar2.Value = 100
'ProgressBar2.Visible = False
End Sub