Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I pull Cell value from Detail worksheet into Summary sheet? John Kotuby[_2_] Excel Worksheet Functions 2 June 16th 09 08:50 PM
IF A CELL ON ONE WORK SHEET MATCHES ANOTHER WORKSHEET conditional format if cell contains word[_2_] Excel Discussion (Misc queries) 7 May 29th 09 12:40 PM
Using cell as worksheet name to return data on that sheet Rookie_User Excel Worksheet Functions 4 January 28th 07 06:27 AM
How:Add New Worksheet that copies the cell of the previous sheet JLM Excel Worksheet Functions 1 August 24th 06 08:04 PM
copy cell from one sheet of worksheet to another sheet Planetjim Excel Discussion (Misc queries) 1 January 10th 06 09:36 AM


All times are GMT +1. The time now is 08:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"