View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
S Himmelrich S Himmelrich is offline
external usenet poster
 
Posts: 76
Default Convert column data to trim all characters and leave the last

Here is what I've come up with:

' Convert account column
Columns("B:B").Select
Selection.Value = Right(Range("B2").Value, 6) 'myVar returns
002075

It doesn't work, it duplicates B2 for all cells with last six
characters...how to make it cycle through all records?







On Dec 6, 9:11 pm, JLGWhiz wrote:
3180015155 002075



and replace the current data with the last 6 characters like this:


002075


Assume the above data is in cell B2 of the ActiveSheet.

myVar =Right(Range("B2").Value, 6) 'myVar returns 002075
Or
myVar = Mid(Range("B2").Value, 12, 6) 'myVar returns 002075

There are more details available in the VBA help files by pressing Alt+F11
and typing [RightFunction] or [MidFunction] in the Help search box, then
select the appropriate one from the menu that is displayed.



"S Himmelrich" wrote:
Can you give me an example of the statement that I'd put in VB?


On Dec 6, 4:52 pm, JLGWhiz wrote:
Right, Left or Mid functions, depending on how your state them.


"S Himmelrich" wrote:
I'm trying to recall the vb syntax to perform the abovefunction,
which will evaluate each row in a column that will have this type of
data:


3180015155 002075


and replace the current data with the last 6 characters like this:


002075


recommendations?- Hide quoted text -


- Show quoted text -