Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
add some text in a cell that has just been inserted
When you use these lines of code in a for loop
Set rng = .Cells(iRow, ServiceGroupColumn) rng.Offset(SvcGrpNum / 2, 0).Resize(rowsToAdd + 1).EntireRow What would be the way to add some text in the irow cell for all those inserted rows. tia, |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
add some text in a cell that has just been inserted
I'm not sure what you mean by the irow cell.
You sure you didn't mean that you want to populate servicegroupcolumn in each of the inserted rows? If yes, this worked ok for me: Option Explicit Sub testme() Dim Rng As Range Dim iRow As Long Dim ServiceGroupColumn As Long Dim SvcGrpNum As Long Dim RowsToAdd As Long ServiceGroupColumn = 3 iRow = 4 SvcGrpNum = 4 RowsToAdd = 17 With Worksheets("Sheet1") Set Rng = .Cells(iRow, ServiceGroupColumn) End With Rng.Offset(SvcGrpNum / 2, 0).Resize(RowsToAdd + 1).EntireRow.Insert Rng.Offset(SvcGrpNum / 2, 0).Resize(RowsToAdd + 1).Value = "hi there" End Sub Janis wrote: When you use these lines of code in a for loop Set rng = .Cells(iRow, ServiceGroupColumn) rng.Offset(SvcGrpNum / 2, 0).Resize(rowsToAdd + 1).EntireRow What would be the way to add some text in the irow cell for all those inserted rows. tia, -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
add some text in a cell that has just been inserted
thanks for answering :-) it helped, I was doing it in a much harder way. "Dave Peterson" wrote: I'm not sure what you mean by the irow cell. You sure you didn't mean that you want to populate servicegroupcolumn in each of the inserted rows? If yes, this worked ok for me: Option Explicit Sub testme() Dim Rng As Range Dim iRow As Long Dim ServiceGroupColumn As Long Dim SvcGrpNum As Long Dim RowsToAdd As Long ServiceGroupColumn = 3 iRow = 4 SvcGrpNum = 4 RowsToAdd = 17 With Worksheets("Sheet1") Set Rng = .Cells(iRow, ServiceGroupColumn) End With Rng.Offset(SvcGrpNum / 2, 0).Resize(RowsToAdd + 1).EntireRow.Insert Rng.Offset(SvcGrpNum / 2, 0).Resize(RowsToAdd + 1).Value = "hi there" End Sub Janis wrote: When you use these lines of code in a for loop Set rng = .Cells(iRow, ServiceGroupColumn) rng.Offset(SvcGrpNum / 2, 0).Resize(rowsToAdd + 1).EntireRow What would be the way to add some text in the irow cell for all those inserted rows. tia, -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Convert Inserted HTML text as Hyperlink | Excel Worksheet Functions | |||
Can I send an inserted shape behind the cell text? | Excel Discussion (Misc queries) | |||
Get a specific cell value/text inserted in a macro | Excel Programming | |||
Blank space gets inserted after text | New Users to Excel | |||
Text not all displaying in a cell, what is max that can be inserted? | Excel Worksheet Functions |