trefwoord toevoegen aan geselecteerde cellen in range

littlepete

Well-known Member
Joined
Mar 26, 2015
Messages
507
Office Version
  1. 365
Platform
  1. Windows
hallo :)

in mijn adressenlijst heb ik een kolom AZ die trefwoorden bevat om op te filteren.
ik probeer nu een macro te construeren die via een inputbox een nieuw trefwoord toevoegt
nadat een selectie is toegevoegd...

Dim dezerng As Range
dezerng = Range("rngmededelingen").SpecialCells(xlCellTypeVisible)
...
With dezerng
.Value = .Value & "gezocht"
End With

ik ken (nog) niet genoeg van vba om de fout te zien...
al bedankt voor jullie reactie :) !

peter, belgie
_________
in redelijkheid bereik je meer !
pjmb@telenet.be
 
hello jerry :) !


Pete,

Is there any reason you're using find-replace on the sheet to test if the code worked? It's more reliable to just look at the visible cells in Col BF after the code is run to see if they had the string added to the existing values. Using find-replace has the possibility of mismatch with "Match Case" or "Match entire contents"

=> i use find/replace to be sure that the keyword doesnt end up elsewhere in my list ... which has happened before ;) ...

Whether that worked or not, you'll probably be better off with code that you understand better than the evaluate function.
The slight difference in speed won't matter unless you are changing thousands of cells at a time.

Try...,

i copied and tried, and i'm very happy to say this one is working perfectly !!! first thing i always do is start a new copy lol ;) !!! adressen d will be adressen e
thank you for your help !!! i do study the differences with the wrong tryouts, best way to learn (i guess) ...


thanks for helping !!!

Pete,
Belgium


Code:
 Set dezerng = Range("bf5", _
   Cells(Rows.Count, "bf").End(xlUp)).SpecialCells(xlCellTypeVisible)
 
 If dezerng Is Nothing Then
   MsgBox "Geen cellen gevonden"
 Else
   For Each cl In dezerng
      cl.Value = cl.Value & " " & gezocht
   Next cl
 End If
 
Upvote 0

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
PROBLEM SOLVED.
PROBLEEM OPGELOST.

if you like to get more details contact me :smile:
als je meer wil weten, vraag het mij gerust.

thanks for the help :smile:
bedankt voor de hulp !!!

Pete,
Belgium
 
Upvote 0

Forum statistics

Threads
1,223,939
Messages
6,175,532
Members
452,651
Latest member
wordsearch

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top