Բաց թողնել հիմնական բովանդակությունը

Ինչպե՞ս գտնել և փոխարինել միանգամից բազմաթիվ արժեքներ Excel- ում:

doc բազմակի գտնել փոխարինել 1

Ինչպես բոլորս գիտեինք, մենք կարող ենք օգտագործել «Գտիր և փոխարինիր» գործառույթը `գտնելու բազմաթիվ նույն բջիջները և դրանք փոխարինելու համար անհրաժեշտ արժեքով: Բայց երբեմն հարկավոր է միաժամանակ շատ-շատերի փոխարինում կիրառել: Օրինակ, ես ունեմ տվյալների մի շարք, և այժմ ես ուզում եմ բոլոր խնձորները փոխարինել կարմիր խնձորներով, նարինջները կանաչ նարինջներով, բանանները դեղին բանաներով և այլն, ինչպես ցույց է տրված հետևյալ նկարներից. Excel?

Միանգամից գտեք և փոխարինեք բազմաթիվ արժեքներ VBA կոդով


նետ կապույտ աջ պղպջակ Միանգամից գտեք և փոխարինեք բազմաթիվ արժեքներ VBA կոդով

Եթե ​​հոգնել եք ժամանակ առ ժամանակ գտնել և փոխարինել արժեքները, հետևյալ VBA կոդը կարող է օգնել ձեզ միանգամից բազմաթիվ արժեքներ փոխարինել անհրաժեշտ տեքստերով:

1, Խնդրում ենք ստեղծել ձեր պայմանները, որոնք ցանկանում եք օգտագործել, որոնք պարունակում են բնօրինակ արժեքներ և նոր արժեքներ: Տեսեք,

doc բազմակի գտնել փոխարինել 2

2, Ապա պահեք ALT + F11 բացել ստեղները Microsoft Visual Basic հավելվածների համար պատուհան:

3: Սեղմեք Տեղադրել > Մոդուլներ, և տեղադրեք հետևյալ կոդը Մոդուլի պատուհանում:

VBA կոդ. Գտեք և միանգամից փոխարինեք բազմաթիվ արժեքներ

Sub MultiFindNReplace()
'Updateby Extendoffice
Dim Rng As Range
Dim InputRng As Range, ReplaceRng As Range
xTitleId = "KutoolsforExcel"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Original Range ", xTitleId, InputRng.Address, Type:=8)
Set ReplaceRng = Application.InputBox("Replace Range :", xTitleId, Type:=8)
Application.ScreenUpdating = False
For Each Rng In ReplaceRng.Columns(1).Cells
    InputRng.Replace what:=Rng.Value, replacement:=Rng.Offset(0, 1).Value
Next
Application.ScreenUpdating = True
End Sub

4, Դրանից հետո սեղմեք F5 Այս կոդն աշխատեցնելու բանալին, դուրս եկած հուշման վանդակում, խնդրում ենք նշել տվյալների տիրույթը, որը ցանկանում եք փոխարինել արժեքները նոր արժեքներով:

doc բազմակի գտնել փոխարինել 3

5: Սեղմեք OK, և ցուցադրվում է մեկ այլ արագ տուփ ՝ հիշեցնելու համար, որ ընտրեք այն չափանիշները, որոնք ստեղծվել եք 1-ին քայլում: Տեսեք,

doc բազմակի գտնել փոխարինել 4

6. Այնուհետեւ կտտացրեք OK, բոլոր հատուկ արժեքները փոխարինվել են նոր արժեքներով, ինչպես ձեզ անմիջապես անհրաժեշտ է:

doc բազմակի գտնել փոխարինել 5


Առնչվող հոդվածներ քանակը:

Ինչպե՞ս գտնել և փոխարինել որոշակի տեքստ տեքստային տուփերում:

Ինչպե՞ս գտնել և փոխարինել տեքստը Excel- ում գծապատկերների վերնագրերում:

Ինչպե՞ս գտնել և փոխարինել տեքստը Excel- ի մեկնաբանություններում:

Ինչպե՞ս փոխել մի քանի հիպերհղման ուղիներ միանգամից Excel- ում:

 

Գրասենյակի արտադրողականության լավագույն գործիքները

🤖 Kutools AI օգնականՀեղափոխություն կատարել տվյալների վերլուծության հիման վրա՝ Խելացի կատարում   |  Ստեղծեք ծածկագիր  |  Ստեղծեք հատուկ բանաձևեր  |  Վերլուծել տվյալները և ստեղծել գծապատկերներ  |  Invoke Kutools-ի գործառույթները...
Հանրաճանաչ հատկություններ: Գտեք, ընդգծեք կամ նույնականացրեք կրկնօրինակները   |  Deleteնջել դատարկ շարքերը   |  Միավորել սյունակները կամ բջիջները՝ առանց տվյալների կորստի   |   Կլոր առանց բանաձևի ...
Super Փնտրել: Բազմաթիվ չափանիշների VLookup    Բազմակի արժեք VLookup  |   VLookup բազմաթիվ թերթերում   |   Fuzzy Փնտրել ....
Ընդլայնված բացվող ցուցակ: Արագ ստեղծեք բացվող ցուցակը   |  Կախված բացվող ցուցակ   |  Բազմակի ընտրություն Drop Down ցուցակ ....
Սյունակի կառավարիչ: Ավելացրեք որոշակի քանակությամբ սյունակներ  |  Տեղափոխել սյունակները  |  Փոխարկել թաքնված սյունակների տեսանելիության կարգավիճակը  |  Համեմատեք միջակայքերը և սյունակները ...
Առանձնահատկություններ: Ցանցի կենտրոնացում   |  Դիզայնի տեսք   |   Մեծ Formula Bar    Աշխատանքային գրքույկի և թերթիկների կառավարիչ   |  Ռեսուրսների գրադարան (Ավտոմատ տեքստ)   |  Ամսաթիվ ընտրող   |  Միավորել աշխատանքային թերթերը   |  Գաղտնագրել/գաղտնազերծել բջիջները    Ուղարկեք նամակներ ըստ ցանկի   |  Սուպեր զտիչ   |   Հատուկ զտիչ (զտել թավ/շեղ/շեղված...) ...
Լավագույն 15 գործիքների հավաքածու12 Տեքստ Գործիքներ (Ավելացրեք տեքստ, Հեռացնել նիշերը, ...)   |   50+ Աղյուսակ Տեսակներ (Գանտի աղյուսակը, ...)   |   40+ Գործնական Բանաձեւեր (Հաշվարկել տարիքը ՝ ելնելով ծննդյան տարեդարձից, ...)   |   19 միացում Գործիքներ (Տեղադրեք QR կոդ, Տեղադրեք նկար ուղուց, ...)   |   12 Փոխարկում Գործիքներ (Բառեր համարներ, Արտարժույթի փոխակերպումը, ...)   |   7 Միաձուլում և պառակտում Գործիքներ (Ընդլայնված կոմբինատ տողեր, Պառակտված բջիջներ, ...)   |   ... եւ ավելին

Լրացրեք ձեր Excel-ի հմտությունները Kutools-ի հետ Excel-ի համար և փորձեք արդյունավետությունը, ինչպես երբեք: Kutools-ը Excel-ի համար առաջարկում է ավելի քան 300 առաջադեմ առանձնահատկություններ՝ արտադրողականությունը բարձրացնելու և ժամանակ խնայելու համար:  Սեղմեք այստեղ՝ Ձեզ ամենաշատ անհրաժեշտ հատկանիշը ստանալու համար...

Նկարագրություն


Office Tab- ը Tabbed ինտերֆեյսը բերում է Office, և ձեր աշխատանքը շատ ավելի դյուրին դարձրեք

  • Միացնել ներդիրներով խմբագրումը և ընթերցումը Word, Excel, PowerPoint- ով, Հրատարակիչ, Access, Visio և Project:
  • Բացեք և ստեղծեք բազմաթիվ փաստաթղթեր նույն պատուհանի նոր ներդիրներում, այլ ոչ թե նոր պատուհաններում:
  • Բարձրացնում է ձեր արտադրողականությունը 50%-ով և նվազեցնում մկնիկի հարյուրավոր սեղմումները ձեզ համար ամեն օր:

 

Comments (136)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Sub MultiFindNReplace()
'Actualizar 20140722
Dim Rng As Range
Dim InputRng As Range, ReplaceRng As Range
xTitleId = "KutoolsforExcel"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Original Range", xTitleId, InputRng.Address, Type:=8)
Set ReplaceRng = Application.InputBox("Replace Range:", xTitleId, Type:=8)
Application.ScreenUpdating = False
For Each Rng In ReplaceRng.Columns(1).Cells
InputRng.Replace what:=Rng.Value, replacement:=Rng.Offset(0, 1).Value, LookAt:=xlWhole
Next
Application.ScreenUpdating = True
End Sub
This comment was minimized by the moderator on the site
amigo este post tiene como 8 años pero funciona, que buen aporte para los que no sabemos excel
This comment was minimized by the moderator on the site
Dei uma modificada no código, e no meu caso, as referências de células são estáticas:

Sub MetodoReplace()

Dim rng As Range, xTitleId As String
Dim inputRng As Range, replaceRng As Range

Application.ScreenUpdating = False

xTitleId = "Metodo Replace"
Set inputRng = Range("A1").CurrentRegion.Offset(1, 0)
Set inputRng = Application.InputBox("Original range:", xTitleId, inputRng.Range("A1").CurrentRegion.Address, _
Type:=8)
Set replaceRng = Application.InputBox("Reaplicar Range:", xTitleId, inputRng.Range("C2").CurrentRegion.Address, _
Type:=8)

For Each rng In replaceRng.Columns(1).Cells
inputRng.Replace What:=rng.Value, Replacement:=rng.Offset(0, 1).Value
Next

Application.ScreenUpdating = True
This comment was minimized by the moderator on the site
Благодарю за экономию моего времени! Успехов!
This comment was minimized by the moderator on the site
Hallo,

ich würde gerne den Text in den Tabellen des Jahresabschlusses automatisch von Deutsch ins Englische übersetzen.
Dazu habe ich eine Excel Arbeitsmappe in welchem die Übersetzungstabelle "Ersatz" enthalten ist und in den folgenden Tabellenblättern die verschiedenen Tabellen wie zb. die Konzernbilanz, GuV, Geldflussrechnung etc.
Dazu habe ich ihren Code versucht zu transformieren. Die Übersetzung erfolgt im Grunde auch, aber zb. Vermögen - Assets; Finanzielle Vermögenswerte - Financial Assets wird nicht korrekt übersetzt, die Finanziellen Vermögenswerte übersetzt es als "Financial Assetswerte". auch in thousands EUR wir offensichtlich mit USA kombiniert.

Hier der Code (meine VBA Kenntnisse sind nur sehr minimalistisch):
Sub MultiFindNReplace2()
'Updateby Alex
Dim Rng As Range
Dim InputRng As Range, ReplaceRng As Range
Dim Ws As Worksheet

Set Ws = Worksheets("Konzernbilanz")
Set Ws = Worksheets("Konzerngesamtergebnis")
Set Ws = Worksheets("Konzerneigenkapitalspiegel")
Set Ws = Worksheets("Konzerngeldfluss")
Set InputRng = Ws.Range("D:Z")

Set Ws = Worksheets("Ersatz")
Set ReplaceRng = Ws.Range("A:B")

Application.ScreenUpdating = False
For Each Rng In ReplaceRng.Columns(1).Cells
InputRng.Replace what:=Rng.Value, replacement:=Rng.Offset(0, 1).Value
Next
Application.ScreenUpdating = True
End Sub

Evtl. haben sie auch eine Idee wie ich dem Programm sagen kann, dass alle Tabellenblätter übersetzt werden müssen, außer natürlich die Tabelle "Ersatz".

Vielen Dank

Sg
Alex
This comment was minimized by the moderator on the site
Buenas !

Sabe alguien si se puede ejecutar en varias hojas de un mismo excel simultaneamente ?


Muchas gracias !!!
This comment was minimized by the moderator on the site
Hello, Roman,
If you want to find and replace in multiple worksheets, the following VBA code may do you a favor.
Note: Sheet1, Sheet2 are the sheet names that you want to find and replace values from, please separate the sheet names by comma; A1:AA100is the original data range you want to replace the specific values.
Sub MultiFindNReplace()
'Updateby Extendoffice
Dim xArrSh()
Dim Rng As Range
Dim xStrRgAddress As String
Dim InputRng As Range, ReplaceRng As Range
Dim xCells As Range
Dim xWSHs As Sheets
Dim xWSh As Worksheet
xArrSh = Array("Sheet1", "Sheet2") 'The sheet names, please separate the sheet names by comma
xStrRgAddress = "A1:AA100" 'the original data range you want to replace
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set ReplaceRng = Application.InputBox("Replace Range :", xTitleId, Type:=8)
If ReplaceRng Is Nothing Then Exit Sub
Set xWSHs = Application.ActiveWorkbook.Worksheets
Application.ScreenUpdating = False
For xI = 0 To UBound(xArrSh)
Set xWSh = xWSHs(xArrSh(xI))
Set xCells = xWSh.Range(xStrRgAddress)
For Each Rng In ReplaceRng.Columns(1).Cells
    xCells.Replace what:=Rng.Value, replacement:=Rng.Offset(0, 1).Value
Next
Next
Application.ScreenUpdating = True
End Sub


After inserting the code, run this code, and a prompt box will pop up, select the original data and new data you want to find and replace with. see screenshot:
https://www.extendoffice.com/images/stories/comments/comment-skyyang/doc-multiple-find-replace.png

Please try, hope it can help you!
This comment was minimized by the moderator on the site
Olá amigos o código é interessante porem não consegui que funciona-se ficarei muito grato se alguém se dispor a ajuda tenho certeza que será útil para outras pessoas.
exemplo:
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 20 21 22 23 25
tenho esses números em uma linha
2 4 5 9 10 11 12 14 15 17 18 20 21 22 25
2 3 4 5 6 8 9 10 11 16 17 18 20 22 23
2 3 4 5 6 7 8 10 11 12 14 15 16 21 22
2 3 4 7 8 10 11 13 14 15 17 20 22 23 25
2 3 8 9 10 11 12 13 14 16 18 20 21 23 25
2 5 6 7 8 9 11 12 13 15 17 18 21 22 23
3 4 6 7 9 11 12 14 15 16 17 18 20 23 25
2 3 4 6 7 8 9 13 14 16 17 18 21 22 25
3 5 6 10 13 14 15 16 17 18 20 21 22 23 25
2 4 5 6 7 8 9 10 12 13 15 16 17 20 25
e esse grupo em outras porem preciso localizar e substituir e criar vinculo das células com seus respectivos números
exemplo: 02 com 02, 03 com 03, 04 com 04
att: Rosemar
This comment was minimized by the moderator on the site
Hello friend,

Sorry to hear that. Your situation is different from the example in the article. Our VBA code can only replace the original values with the value you define. It can't create a link between the cells with their respective numbers. Sorry for that. Have a nice day.

Sincerely,
Mandy
This comment was minimized by the moderator on the site
Bonjour,
merci pour votre support. Cela répond presque à mon besoin.Par contre, comment faire quand la même valeur se trouve dans "Origine value" et "Replacing value" car la valeur modifiée redevient la valeur d'origine ?Exemple : Origine value    ->    Replacing value
 
13h - 21h  ->  5h - 13h
8h - 16h   -> 10h - 18h
10h - 18h  ->  8h - 16h

Merci par avance pour votre aide
This comment was minimized by the moderator on the site
hello can we change also color ?  ex : i wanna change apple to red apple with the red filled cell
This comment was minimized by the moderator on the site
Is this method can be use if between sentence in a cell?e.g I want to change numbers between the line : abcdefghi 12345 jklmnopqrstu >>> abcdefghi 67891 jklmnopqrstu

if no is there any other method can be use? Please help. Thank you!
This comment was minimized by the moderator on the site
Hello, qill,The code in this article can finish your problem, please try, thank you!

There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations