Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default Concatenate values

Trying to concatenate data that is imported in a file but having a problem.

..Offset(0, 2).Value = Right("0000000" & myID & "h", 4)

Data Want Get
2C0 2C0h 2C0h
402 402h 402h
0 000h 0 h - two spaces between 0 and h
14 0014h 14 h - one space b/w 14 and h
2 0002h 2 h - two spaces between 2 and h

Second problem is some of the data that is imported is "00" and I want to
keep this
format but when imported the "00" becomes "0".

Any suggestions?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Concatenate values

Dan,

try this:

Sub dan()

ActiveCell.Offset(0, 2).Value = Format(ActiveCell.Value, "000") & "h"
End Sub

Maybe that will get you started in the right direction.

Regards,

Dave

Dan wrote:
Trying to concatenate data that is imported in a file but having a problem.

.Offset(0, 2).Value = Right("0000000" & myID & "h", 4)

Data Want Get
2C0 2C0h 2C0h
402 402h 402h
0 000h 0 h - two spaces between 0 and h
14 0014h 14 h - one space b/w 14 and h
2 0002h 2 h - two spaces between 2 and h

Second problem is some of the data that is imported is "00" and I want to
keep this
format but when imported the "00" becomes "0".

Any suggestions?

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default Concatenate values

Actually your statement about Format trigger a solution.

..Offset(0, 2).Value = Right("'000" & Trim(myID) & "h", 4)

Realized there was possibly spaces during import that I could format out
with Trim. This corrected the problem.

Thanks

"davy_gravy" wrote:

Dan,

try this:

Sub dan()

ActiveCell.Offset(0, 2).Value = Format(ActiveCell.Value, "000") & "h"
End Sub

Maybe that will get you started in the right direction.

Regards,

Dave

Dan wrote:
Trying to concatenate data that is imported in a file but having a problem.

.Offset(0, 2).Value = Right("0000000" & myID & "h", 4)

Data Want Get
2C0 2C0h 2C0h
402 402h 402h
0 000h 0 h - two spaces between 0 and h
14 0014h 14 h - one space b/w 14 and h
2 0002h 2 h - two spaces between 2 and h

Second problem is some of the data that is imported is "00" and I want to
keep this
format but when imported the "00" becomes "0".

Any suggestions?

Thanks



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
concatenate values Flint springs Excel Worksheet Functions 4 May 23rd 09 08:41 PM
Concatenate Values with VBA jlclyde Excel Discussion (Misc queries) 2 October 1st 08 07:05 PM
Concatenate values IF() Nikki Excel Worksheet Functions 21 May 12th 07 11:06 PM
Concatenate values dan Excel Worksheet Functions 2 August 14th 06 11:03 PM
concatenate values / convert to csv help Will[_7_] Excel Programming 2 May 18th 04 02:50 PM


All times are GMT +1. The time now is 03:44 AM.

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"