+ Reply to Thread
Results 1 to 4 of 4

Macro for Renaming the whole row except first cell

Hybrid View

Haidar123 Macro for Renaming the whole... 04-03-2014, 03:08 PM
protonLeah Re: Macro for Renaming the... 04-03-2014, 03:49 PM
Haidar123 Re: Macro for Renaming the... 04-03-2014, 04:11 PM
protonLeah Re: Macro for Renaming the... 04-03-2014, 08:40 PM
  1. #1
    Registered User
    Join Date
    03-21-2014
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    80

    Smile Macro for Renaming the whole row except first cell

    Hello,

    I want to rename every cell in first row until last column except first A1 cell.
    and the name which i want to give new cells in row are Act1 Act2 Ac3 upto last cell. for example if it is 12th cell then Act12.

    Actually I want to rename the title of every column except first column.

    Need Macro

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: Macro for Renaming the whole row except first cell

    Option Explicit
    
    Sub Macro1()
        Dim FillRange As String
        
        With Sheets("sheet1")
             FillRange = "B1:" & .Cells(1, Columns.Count).End(xlToLeft).Address(0, 0)
            .Range("B1").Select
            ActiveCell.FormulaR1C1 = "Act1"
            .Range("B1").Select
            Selection.AutoFill Destination:=Range(FillRange), Type:=xlFillDefault
            .Range(FillRange).Select
        End With
    End Sub
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    03-21-2014
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Macro for Renaming the whole row except first cell

    can you modify it so that it can be applied to multiple sheets except first sheet in an excel file.

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: Macro for Renaming the whole row except first cell

    How do you identify which one is the first...name???
    Option Explicit
    
    Sub Macro1()
        Dim FillRange   As String, _
            CurrentTab  As Worksheet
        
        For Each CurrentTab In ThisWorkbook.Sheets
            If CurrentTab.Name <> "the first one" Then
                With Sheets(CurrentTab.Name)
                     FillRange = "B1:" & .Cells(1, Columns.Count).End(xlToLeft).Address(0, 0)
                    .Range("B1").Select
                    ActiveCell.FormulaR1C1 = "Act1"
                    .Range("B1").Select
                    Selection.AutoFill Destination:=.Range(FillRange), Type:=xlFillDefault
                    .Range(FillRange).Select
                End With
            End If
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro for renaming fiiles
    By floricita in forum Excel Programming / VBA / Macros
    Replies: 31
    Last Post: 01-06-2014, 10:37 AM
  2. macro for renaming
    By graphicsmanx1 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-05-2012, 04:22 PM
  3. renaming files with macro
    By kaffal in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-29-2009, 05:15 PM
  4. Macro for renaming sheets
    By Joeg101 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-10-2008, 05:40 PM
  5. Renaming a Macro
    By Excel User in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-31-2006, 03:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1