# Combining text box values



## Adam19931 (Jan 1, 2023)

Hi all, I have a user form that inputs the data into a master sheet. I am looking to amend the VBA code below so the values from text boxes frmForm.txtOrder1 and frmForm.txtOrder2 are pulled into the worksheet combined, separated by a comma and ignore empty fields. At present they are pulled in separately and then combined using a textjoin formula. Is there a way to do this using VBA  please?


```

```

 With sh

        .Cells(irow, 1) = "3T-" & irow - 1
        .Cells(irow, 2) = frmForm.txtWeek.Value
        .Cells(irow, 3) = frmForm.txtOrder1.Value
        .Cells(irow, 4) = frmForm.txtOrder2.Value
        .Cells(irow, 5) = frmForm.txtDestName.Value
        .Cells(irow, 6) = frmForm.txtDestLocation.Value

   End With


----------



## Alex Blakenburg (Jan 2, 2023)

Have you tried something like this:

```
.Cells(irow, 3) = WorksheetFunction.TextJoin(",", True, frmForm.txtOrder1.Value, frmForm.txtOrder2.Value)
```


----------

