ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change cell data using excel 2003 (https://www.excelbanter.com/excel-programming/371805-change-cell-data-using-excel-2003-a.html)

jfcby[_2_]

Change cell data using excel 2003
 
Hello,

I have 100 worksheets with 3 columns of data and 1 row to 500 rows. In
column C my data looks like so
125
252
CO125
CO314
MECH
MECH2

This is my question -
How can I change my data in the cells with CO125 or CO314 to look like
this 125CO or 314CO?

I've searched for code to help me but I've been unsuccessful! Please
Help!

Thank you for help,
jfcby


kassie

Change cell data using excel 2003
 
The easiest would be a formula in a helper column
With your number in say A1, then in B1 ente
=IF(LEFT(A1,2)="CO",RIGHT(A1,LEN(A1)-2)&LEFT(A1,2),IF(LEFT(A1,4)="MECH",RIGHT(A1,LEN(A1 )-4)&LEFT(A1,4),A1))
Copy down.

Else you ned to write a macro with a for next loop

"jfcby" wrote:

Hello,

I have 100 worksheets with 3 columns of data and 1 row to 500 rows. In
column C my data looks like so
125
252
CO125
CO314
MECH
MECH2

This is my question -
How can I change my data in the cells with CO125 or CO314 to look like
this 125CO or 314CO?

I've searched for code to help me but I've been unsuccessful! Please
Help!

Thank you for help,
jfcby



[email protected]

Change cell data using excel 2003
 
Try:

Sub TestData()
Dim MyCell As Range
For Each MyCell In Selection
If Left(MyCell.Value, 2) = "CO" Then
MyCell.Value = Right(MyCell.Value, Len(MyCell.Value) - 2) & "CO"
End If
Next
End Sub

Alan

jfcby wrote:
Hello,

I have 100 worksheets with 3 columns of data and 1 row to 500 rows. In
column C my data looks like so
125
252
CO125
CO314
MECH
MECH2

This is my question -
How can I change my data in the cells with CO125 or CO314 to look like
this 125CO or 314CO?

I've searched for code to help me but I've been unsuccessful! Please
Help!

Thank you for help,
jfcby



jfcby[_2_]

Change cell data using excel 2003
 
Hello,

Than you for your help! The code works great!

jfcby

wrote:
Try:

Sub TestData()
Dim MyCell As Range
For Each MyCell In Selection
If Left(MyCell.Value, 2) = "CO" Then
MyCell.Value = Right(MyCell.Value, Len(MyCell.Value) - 2) & "CO"
End If
Next
End Sub

Alan

jfcby wrote:
Hello,

I have 100 worksheets with 3 columns of data and 1 row to 500 rows. In
column C my data looks like so
125
252
CO125
CO314
MECH
MECH2

This is my question -
How can I change my data in the cells with CO125 or CO314 to look like
this 125CO or 314CO?

I've searched for code to help me but I've been unsuccessful! Please
Help!

Thank you for help,
jfcby




All times are GMT +1. The time now is 05:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com