+ Reply to Thread
Results 1 to 5 of 5

Macro to insert a letter into first empty cell in a column on all sheets

Hybrid View

  1. #1
    Registered User
    Join Date
    02-01-2012
    Location
    RHODE ISLAND
    MS-Off Ver
    Excel 2007
    Posts
    4

    Macro to insert a letter into first empty cell in a column on all sheets

    I am trying to insert the letter "E" into the first empty cell in Column BB on every worksheet in a workbook except Sheet1.

    This is what I have so far, but no success in getting it to work. Any help is greatly appreciated.

    Sub Macro3()
    
     
    activeCell.FormulaR1C1 = "E"
    Range(Selection, Selection.End(xlDown)).Copy Destination:=Dim wsSheet As Worksheet
     For Each wsSheet In ThisWorkbook.Worksheets.Range("BB" & Rows.Count).End(xlUp).Offset(1)
    End Sub

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,261

    Re: Macro to insert a letter into first empty cell in a column on all sheets

    Hi pimind,

    Try this code:
    Sub PutInE()
        Dim ShtCtr As Double
        Dim BlankRow As Double
        For ShtCtr = 2 To Worksheets.Count
            If Cells(2, "BB") = "" Then Cells(2, "BB") = "Fill"
            BlankRow = Cells(1, "BB").End(xlDown).Row + 1
            Cells(BlankRow, "BB") = "E"
        Next ShtCtr
    End Sub
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,784

    Re: Macro to insert a letter into first empty cell in a column on all sheets

    Or like this perhaps?

    Option Explicit
    
    Sub InsertVal()
    Dim i As Integer
    
    For i = 2 To Sheets.Count
    
    Sheets(i).Activate
    If Range("BB" & Rows.Count).End(xlUp).Row = 1 And Range("BB1") = "" Then
        Range("BB1").Value = "E"
    Else
        Range("BB" & Rows.Count).End(xlUp).Offset(1, 0) = "E"
    End If
    
    Next i
        
    End Sub
    Alf

  4. #4
    Registered User
    Join Date
    02-01-2012
    Location
    RHODE ISLAND
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Macro to insert a letter into first empty cell in a column on all sheets

    Thank you Marvin P and Alf, Both codes work great. I went with Alf's because I was able to adapt it to my needs a little better. Thanks you both again.

  5. #5
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,784

    Re: Macro to insert a letter into first empty cell in a column on all sheets

    Hi pimind

    Thanks for feedback and rep.

    Alf

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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