Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Is there a more elegant way to macro this?

Sub changekey()
If Range("b1").Value = "Joint" Then
Range("key1").Value = "J" & Mid(Range("key1").Value, 2, 255)
End If
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tim Tim is offline
external usenet poster
 
Posts: 145
Default Is there a more elegant way to macro this?

Maybe not more elegant, but it would be more robust if you qualify all
appropriate Range's with a sheet reference.

Tim

"Brad" wrote in message
...
Sub changekey()
If Range("b1").Value = "Joint" Then
Range("key1").Value = "J" & Mid(Range("key1").Value, 2, 255)
End If
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Is there a more elegant way to macro this?

Brad,
You can work with the .Characters instead:

Range("key1").Characters(1, 1).Text = "J"

NickHK

"Brad" wrote in message
...
Sub changekey()
If Range("b1").Value = "Joint" Then
Range("key1").Value = "J" & Mid(Range("key1").Value, 2, 255)
End If
End Sub



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Is there a more elegant way to macro this?

Thank you

"NickHK" wrote:

Brad,
You can work with the .Characters instead:

Range("key1").Characters(1, 1).Text = "J"

NickHK

"Brad" wrote in message
...
Sub changekey()
If Range("b1").Value = "Joint" Then
Range("key1").Value = "J" & Mid(Range("key1").Value, 2, 255)
End If
End Sub




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Elegant Formulas littleredhairedgirl Excel Worksheet Functions 2 December 31st 08 06:39 AM
Is there an elegant way? veryeavy Excel Discussion (Misc queries) 5 February 1st 07 03:30 AM
Is there an elegant solution to this table? [email protected] Excel Discussion (Misc queries) 3 July 9th 06 01:31 PM
More elegant way to do IF () Barb Reinhardt Excel Worksheet Functions 7 May 6th 06 09:36 AM
More elegant method? Biff Excel Worksheet Functions 0 January 13th 06 08:23 AM


All times are GMT +1. The time now is 08:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"