Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Add Sheet Name to Cell in Worksheet
I would like to add the sheet name to cell H in the worksheet but only those
rows that have text in them. How would I do that with code? Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Add Sheet Name to Cell in Worksheet
Have text where in the row? Anywhere or in a single columnn
assume column G and the text are constants set rng = columns(7).specialcells(xlconstants,xltextvalues) set rng1 = Intersect(rng.entireRow, Columns(8)) rng1.Value = Activesheet.name -- Regards, Tom Ogilvy "ploddinggaltn" wrote: I would like to add the sheet name to cell H in the worksheet but only those rows that have text in them. How would I do that with code? Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Add Sheet Name to Cell in Worksheet
do you mean column H and text in any cell in the row?
If so: Sub AddSheetName() Dim mCell As Range, mRow As Range For Each mCell In Range("H:H") For Each mRow In Range(mCell, _ Cells(mCell.Row, Columns.Count).End(xlToLeft).Address) If Not mRow.Value = Empty Then mCell.Value = ActiveSheet.Name End If Next mRow Next mCell End Sub Sandy ploddinggaltn wrote: I would like to add the sheet name to cell H in the worksheet but only those rows that have text in them. How would I do that with code? Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I pull Cell value from Detail worksheet into Summary sheet? | Excel Worksheet Functions | |||
IF A CELL ON ONE WORK SHEET MATCHES ANOTHER WORKSHEET | Excel Discussion (Misc queries) | |||
Using cell as worksheet name to return data on that sheet | Excel Worksheet Functions | |||
How:Add New Worksheet that copies the cell of the previous sheet | Excel Worksheet Functions | |||
copy cell from one sheet of worksheet to another sheet | Excel Discussion (Misc queries) |