PC Review


Reply
Thread Tools Rate Thread

copying sheet name

 
 
oldjay
Guest
Posts: n/a
 
      9th Dec 2009
I want to copy the sheet name to row 1 of the first blank column after col 15

Oldjay
 
Reply With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      9th Dec 2009
If ActiveSheet.Range("O1").Offset(0,1) = "" Then
ActiveSheet.Range("P1") = ActiveSheet.Name
Esle
ActiveSheet.Range("O1").End(xlToRight).Offset(0, 1) = ActiveSheet.Name
End If



"oldjay" <(E-Mail Removed)> wrote in message
news:FCF8E3C8-0894-429F-86E7-(E-Mail Removed)...
>I want to copy the sheet name to row 1 of the first blank column after col
>15
>
> Oldjay



 
Reply With Quote
 
Ryan H
Guest
Posts: n/a
 
      9th Dec 2009
This should help.

Sub FindLastColumn()

Dim lngLastColumn As Long

lngLastColumn = ActiveSheet.Rows(1).Find(What:="", _
After:=Cells(1, 15), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=True, _
SearchFormat:=False).Column

Cells(1, lngLastColumn) = ActiveSheet.Name

End Sub

If this helps let me know. Click "YES" below.
--
Cheers,
Ryan


"oldjay" wrote:

> I want to copy the sheet name to row 1 of the first blank column after col 15
>
> Oldjay

 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      9th Dec 2009
corrected:

If ActiveSheet.Range("O1").Offset(0,1) = "" Then
ActiveSheet.Range("P1") = ActiveSheet.Name
Else
ActiveSheet.Range("O1").End(xlToRight).Offset(0, 1) = ActiveSheet.Name
End If



"JLGWhiz" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> If ActiveSheet.Range("O1").Offset(0,1) = "" Then
> ActiveSheet.Range("P1") = ActiveSheet.Name
> Esle
> ActiveSheet.Range("O1").End(xlToRight).Offset(0, 1) = ActiveSheet.Name
> End If
>
>
>
> "oldjay" <(E-Mail Removed)> wrote in message
> news:FCF8E3C8-0894-429F-86E7-(E-Mail Removed)...
>>I want to copy the sheet name to row 1 of the first blank column after col
>>15
>>
>> Oldjay

>
>



 
Reply With Quote
 
Patrick Molloy
Guest
Posts: n/a
 
      9th Dec 2009
Sub setsheetname()

With Cells(1, WorksheetFunction.Max(Cells(1,
Columns.Count).End(xlToLeft).Column + 1, 15))
.Value = ActiveSheet.Name
End With

End Sub


go to the rightmost column, then get the END/LEFT column number and add 1,
use 15 or this if its larger




"oldjay" <(E-Mail Removed)> wrote in message
news:FCF8E3C8-0894-429F-86E7-(E-Mail Removed)...
> I want to copy the sheet name to row 1 of the first blank column after col
> 15
>
> Oldjay


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help Taking alot data from one sheet (if not blank) and copying toa list on another sheet. Alex Zuniga Microsoft Excel Worksheet Functions 1 25th Nov 2009 11:54 PM
copying a template sheet and inputting a formula into another sheetthat references the new sheet A & S Microsoft Excel Programming 1 29th Jul 2009 08:59 PM
Copying rows values on one sheet to part of a formula in a column onanother sheet. Manosh Microsoft Excel Discussion 2 23rd Jun 2009 03:58 AM
Copying a protected sheet to another sheet or workbook loses prote Rudy Microsoft Excel Crashes 0 30th Nov 2007 10:17 PM
Copying cells from on sheet to another sheet (via sheet module) =?Utf-8?B?Q1JheUY=?= Microsoft Excel Programming 6 20th Sep 2005 08:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:34 AM.