VBA code not working in some cells in the excel file

zack8576

Active Member
Joined
Dec 27, 2021
Messages
271
Office Version
  1. 365
Platform
  1. Windows
I have this code that copies the text from column B to in front of the text in column K (same row)
See screenshot below, code worked on 163, but not on K164-167; it also worked on K175 but not on 176-179. Any reason why it is doing this?
also, What if I just want to add the text and a space without parenthesis, so (SAN-TOHO)LINER, would become SAN-TOHO LINER

1674239638043.png


VBA Code:
Sub AssignStructureIDToLiner()
  With Range("K2:K" & Range("K" & Rows.Count).End(xlUp).Row)
    .Value = Evaluate(Replace("=if(@=""LINER"",""(""&" & .Offset(, -9).Address & "&"")""&@,if(@="""","""",@))", "@", .Address))
  End With
End Sub
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
In which column you're referring the (SAN-TOHO)LINER ? and your need would be (SAN-TOHO)LINER paste in column K without () and with space right ?
 
Upvote 0
In which column you're referring the (SAN-TOHO)LINER ? and your need would be (SAN-TOHO)LINER paste in column K without () and with space right ?
These are always in column K, yes and yes
 
Upvote 0
Great. Will give a try. Could you upload few data's with the help of xl2bb here ? Since it is a image, i need to type every time.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,206
Members
452,618
Latest member
Tam84

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