Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8357557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:31:05+00:00 2026-06-09T10:31:05+00:00

I have a spread sheet and I need to look for the last column

  • 0

I have a spread sheet and I need to look for the last column that has data in it. Then I need to copy this column and copy it to the next blank column.

Is there a way to do this?

I’ve managed to do it with rows using:

lastrowSrc = Sheets("Overview").Range("B" & Rows.Count).End(xlUp).Row

However this puts B12 in the range, using columns.count simply puts in the number of the column, not the letter

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T10:31:06+00:00Added an answer on June 9, 2026 at 10:31 am

    To get the exact column in a worksheet, use this code.

    Option Explicit
    
    Sub Sample()
        Dim ws As Worksheet
        Dim LastCol As Long
    
        Set ws = Sheets("Sheet1")
    
        '~~> This check is required else .FIND will give you error on an empty sheet
        If Application.WorksheetFunction.CountA(ws.Cells) = 0 Then
            LastCol = 1
        Else
            LastCol = ws.Cells.Find(What:="*", _
                    After:=ws.Range("A1"), _
                    Lookat:=xlPart, _
                    LookIn:=xlFormulas, _
                    SearchOrder:=xlByColumns, _
                    SearchDirection:=xlPrevious, _
                    MatchCase:=False).Column
        End If
    
        Debug.Print LastCol
    End Sub
    

    EDIT: This is courtesy @brettdj. You can also use the range object to find the last column

    Option Explicit
    
    Sub Sample()
        Dim ws As Worksheet
        Dim LastCol As Long
        Dim rng As Range
    
        Set ws = Sheets("Sheet1")
    
        Set rng = ws.Cells.Find(What:="*", _
                    After:=ws.Range("A1"), _
                    Lookat:=xlPart, _
                    LookIn:=xlFormulas, _
                    SearchOrder:=xlByColumns, _
                    SearchDirection:=xlPrevious, _
                    MatchCase:=False)
    
        If rng Is Nothing Then
            LastCol = 1
        Else
            LastCol = rng.Column
        End If
    
        Debug.Print LastCol
    End Sub
    

    To get the last column of a particular row, say row 1 use this

        Debug.Print ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column
    

    Where ws is your relevant worksheet.

    Similarly for Row see this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an excel spreadsheet that is password-protected. I need to open this spreadsheet
I have an excel spread sheet (well, hundreds of them) which I need importing
I have a Excel spreadsheet that has two tabs, I have data on the
I have an Excel Spreadsheet that contains all my data that I need to
I have a requirement to do some imports from an Excel spread sheet and
Like many, I have spreadsheet that draws data from over 40 text files as
I have a spreadsheet that I am sorting based on an item number column.
I have a large spreadsheet with a column called Roles. In this columns are
Background I have a spreadsheet of data that I'm importing into SQL Server 2005.
I have a Excel Spreadsheet with lab data which looks like this: µg/L (ppb)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.