Safequip Member Aug 26, 2014 #1 Hi I have a worksheet that I want to prefix all existing codes with LY can you help?
L Lymm Member Aug 26, 2014 #2 Hi, do you have a sample file with layout of what you need. It will help with a speedier reply if folks know exactly what you are trying to do.
Hi, do you have a sample file with layout of what you need. It will help with a speedier reply if folks know exactly what you are trying to do.
Safequip Member Aug 26, 2014 #3 E61700 2 E61L5 4UK E65 2UK E65100 2 E65200 2UK E65200 2UK E65300 2 E69 P E72 ACUK E72 P E73 P E76 P E78001 E78002 E78003 E78004 E78900 E78901 E78AHB E78BHB E78CHB I have a worksheet with codes as above, I need to Prefix them so they all have LY in front of the E Hope this makes sense Thanks
E61700 2 E61L5 4UK E65 2UK E65100 2 E65200 2UK E65200 2UK E65300 2 E69 P E72 ACUK E72 P E73 P E76 P E78001 E78002 E78003 E78004 E78900 E78901 E78AHB E78BHB E78CHB I have a worksheet with codes as above, I need to Prefix them so they all have LY in front of the E Hope this makes sense Thanks
Mike H.. Active Member Aug 26, 2014 #4 Safequip said: E61700 2 E61L5 4UK E65 2UK E65100 2 E65200 2UK E65200 2UK E65300 2 E69 P E72 ACUK E72 P E73 P E76 P E78001 E78002 E78003 E78004 E78900 E78901 E78AHB E78BHB E78CHB I have a worksheet with codes as above, I need to Prefix them so they all have LY in front of the E Hope this makes sense Thanks Click to expand... Hi, ALT+F11 to open VB editor, right click 'ThisWorkbook' and insert module and paste the code below in. Select all your data and run the code. Code: Sub Add_Prefix() Dim c As Range For Each c In Selection c.Value = "LY" & c.Value Next End Sub
Safequip said: E61700 2 E61L5 4UK E65 2UK E65100 2 E65200 2UK E65200 2UK E65300 2 E69 P E72 ACUK E72 P E73 P E76 P E78001 E78002 E78003 E78004 E78900 E78901 E78AHB E78BHB E78CHB I have a worksheet with codes as above, I need to Prefix them so they all have LY in front of the E Hope this makes sense Thanks Click to expand... Hi, ALT+F11 to open VB editor, right click 'ThisWorkbook' and insert module and paste the code below in. Select all your data and run the code. Code: Sub Add_Prefix() Dim c As Range For Each c In Selection c.Value = "LY" & c.Value Next End Sub
shrivallabha Excel Ninja Aug 26, 2014 #5 Or a non looper: Code: Sub AddPref2() With Selection .Value = Evaluate("IF(" & .Address & "<>""""" & "," & """LY""" & "&" & .Address & "," & """""" & ")") End With End Sub
Or a non looper: Code: Sub AddPref2() With Selection .Value = Evaluate("IF(" & .Address & "<>""""" & "," & """LY""" & "&" & .Address & "," & """""" & ")") End With End Sub