Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 337
Default copying sheet name

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

Oldjay
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default copying sheet name

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" wrote in message
...
I want to copy the sheet name to row 1 of the first blank column after col
15

Oldjay



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default copying sheet name

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default copying sheet name

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" wrote in message
...
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" wrote in message
...
I want to copy the sheet name to row 1 of the first blank column after col
15

Oldjay





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default copying sheet name

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" wrote in message
...
I want to copy the sheet name to row 1 of the first blank column after col
15

Oldjay


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
Need help Taking alot data from one sheet (if not blank) and copying toa list on another sheet. Alex Zuniga Excel Worksheet Functions 1 November 25th 09 11:54 PM
copying a template sheet and inputting a formula into another sheetthat references the new sheet A & S Excel Programming 1 July 29th 09 08:59 PM
HAVE ONE REPORT SHEET WITH LINKS FROM VARIOUS SHEETS. ON COPYING THIS LINKED SHEET FOR EXPORTING IT TO THE OFFICE GET ERRORS IN CELLS. HOW TO RESOLVE THIS? CAPTGNVR Excel Programming 4 February 17th 07 06:12 PM
Copying cells from on sheet to another sheet (via sheet module) CRayF Excel Programming 6 September 20th 05 08:58 PM
2 questions, copying data from sheet to sheet and assigning macro Boris Excel Worksheet Functions 0 December 16th 04 06:11 PM


All times are GMT +1. The time now is 03:42 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"