in Education by
I have a table: Using vba I need to add a column after UsedRange, add a header and fill cells after header with the same value until the last cell of UsedRange: I have added new column and header: Worksheets(ii).Cells(, Worksheets(ii).UsedRange.SpecialCells(xlCellTypeLastCell).Column + 1).Value2 = "Column 4" How can I fill values to the column (ignoring header)? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
You can do it this way. I think CurrentRegion is more robust than SpecialCells(xlCellTypeLastCell). Sub x() Dim r As Range Set r = Range("A1").CurrentRegion r.Cells(1, r.Columns.Count + 1).Value = "Column 4" r.Cells(2, r.Columns.Count + 1).Resize(r.Rows.Count - 1).Value = 2 End Sub

Related questions

0 votes
    I have a table: Using vba I need to add a column after UsedRange, add a header and fill cells ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: Extracting Unique values from a list (2 answers) Closed 7 years ago ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 21, 2022 in Education by JackTerrance
0 votes
    I have encountered a problem during my work. There are over one hundred worksheets in my excel, and I ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I have updated an Excel add-in that used to work fine apart from some new requirements. I've ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    I have two sheets sheet1, sheet2. Sheet2 having the with records and duplicate number. like sheet1 1--- ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 16, 2022 in Education by JackTerrance
0 votes
    I have the dataset that has the no_employees column that is the str object. whats is a best way to create the new ... 1-5 |Very Small Select the correct answer from above options...
asked Jan 19, 2022 in Education by JackTerrance
0 votes
    I am trying to adjust the row height based on the cell value. The operation have to run through ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 1, 2022 in Education by JackTerrance
0 votes
    I am trying to export p-values to Excel from the Stata community-contributed command reghdfe: // get data ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    I would like to move an entire row to the bottom of a spread sheet if the column k contains a 0 ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 21, 2022 in Education by JackTerrance
0 votes
    I am using a macro to write a formula into a cell on my Excel worksheet. The formula is written ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 5, 2022 in Education by JackTerrance
0 votes
    I have an issue where i want to import value from a textfile into my excel-document which it does ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
0 votes
    Below, I have code that sends a personalized SMS message and includes the name. I got that part to ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 17, 2022 in Education by JackTerrance
0 votes
    I am trying to do some validation on the file name before it's saved. Here are my three file- ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 14, 2022 in Education by JackTerrance
0 votes
    Below, I have code that sends a personalized SMS message and includes the name. I got that part to ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 13, 2022 in Education by JackTerrance
0 votes
    I have a column array with the following values in my sheet: 11, 15, 5, 7, 2. I want to ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
...