CaptainKen
New Member
- Joined
- Oct 31, 2023
- Messages
- 23
- Office Version
- 365
- Platform
- Windows
I got TextJoin to work in a cell and within code as shown below. What I need to do is to go to the next step, which would be populate the rest of the rows in column C based on values in columns A and B. The number of rows is an unknown. I assume I'd need a Loop or something, but I'm not that knowledgeable.
Column A: Movie name (300 Collection)
Column B: Movie path (movie sets\300 Collection)
Column C: Results populated in this column
This is an example of the desired output:
xcopy "movie sets\300 Collection\*.jpg" "v:\300 Collection" /i
This works from within a cell:
=TEXTJOIN("",TRUE, "xcopy """, "m:\", B1, "\*.jpg"" ""v:\", A1, """ /i")
This works as VBA, although is inserts a single quote as the first character
Column A: Movie name (300 Collection)
Column B: Movie path (movie sets\300 Collection)
Column C: Results populated in this column
This is an example of the desired output:
xcopy "movie sets\300 Collection\*.jpg" "v:\300 Collection" /i
This works from within a cell:
=TEXTJOIN("",TRUE, "xcopy """, "m:\", B1, "\*.jpg"" ""v:\", A1, """ /i")
This works as VBA, although is inserts a single quote as the first character
VBA Code:
Dim strResult As Sring
Dim Sep As String
'Sep represents one double quotation mark
Sep = """"
'MsgBox Sep & "TEXT HERE" & Sep & Range("B1").Value & Sep
strResult = WorksheetFunction.TextJoin("", True, "xcopy ", Sep, "m:\", Range("B1").Value, "\*.jpg", Sep, Space(1), Sep, "v:\", Range("A1").Value, Sep, "/i")
MsgBox strResult
Range("C1").Value = strResult