简体   繁体   English

将单元格中的破折号替换为串联结果中的星号

[英]Replace dashes in cell with asterisks in concatenated result

I'm concatenating columns into a single string.我将列连接成一个字符串。

The problem is the SKU col, that also includes dashes, when dashes are used to separate columns.问题是 SKU 列,它还包括破折号,当破折号用于分隔列时。

So I'd like to replace dashes with asterics in result:所以我想在结果中用星号替换破折号:

From: ppl-lal-myproduct-s-fd334343-09-otro来自: ppl-lal-myproduct-s-fd334343-09-otro

To: ppl-lal-myproduct-s*fd334343*09-otro收件人: ppl-lal-myproduct-s*fd334343*09-otro

在此处输入图像描述

A VBA solution to do replacing and concatenation would be the next:下一个进行替换和连接的 VBA 解决方案将是:

   Dim arr1D
   With Range("C5:G5")
        .Replace "-", "*"
        arr1D = Application.Transpose(Application.Transpose(.Value2)) 'make 1D array form a row range
   End With
   Debug.Print Join(arr1D, "-")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM