0

I would like to add additional fixed text to textbox data in specific cells in an Excel spreadsheet. For example, in the textbox the user would enter "g0/0" but in the cell A2 it should read "interface g0/0". Here is what i have so far:

Private Sub Populate_Click()
Dim ws As Worksheet
Set ws = Worksheets("Remote")
ws.Range("A2") = Interface.Value

So I assume i would add "interface" somewehere on that last line but i am unsure of the syntax. thanks!

2 Answers 2

1

You may need to first sonstrict the required value in a string, then make that the value of "A2". Assuming your input text box is on a form...

Dim InterfaceValue as string
InterfaceValue = "interface" &  FormName.InputTextBox.Value
ws.Range("A2").value = InterfaceValue
Sign up to request clarification or add additional context in comments.

1 Comment

You, my friend, are an evil genius!. Works like a charm!
0

You can try to loop all the rows, and insert fixed string value to a cell.

Ex.

for(XMLResource report: reports) {

        Row row = sheet.createRow(rowNum++);
        sheet.setColumnWidth(0, 1000);
        row.createCell(0)
                .setCellValue(report.getPage());

        row.createCell(1)
                .setCellValue(report.getTestName());

        row.createCell(2)
                .setCellValue(report.getDescription());

        row.createCell(3)
                .setCellValue(report.getSTATUS());

        row.createCell(4)
                .setCellValue(report.getBuisImpact());

        row.createCell(5)
        .setCellValue(report.getVali());
    }

(report is string only object)

2 Comments

Not sure this will work. I don't want to create cells. This is an userform to add data to an existing excel spreadsheet in specific cells to simplify building configurations
Gotcha! try row.getCell(i).setValue(YOUR VALUE), and you can update you'r excel sheet every time new data has arrived.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.