Results 1 to 2 of 2

Thread: Excel, end column plus 1

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2003
    Posts
    2

    Excel, end column plus 1

    i would like to move to the column after the last column that contains data, but with out specifying a column letter to enure that this postion will be kept should any other colmns be added resulting in the very end column becoming a different letter. Can anyone provide any advice or even better some code for me to acheive this. this could be very simple but im not experianced in VB in the slightest. Thanks

  2. #2
    Fanatic Member WorkHorse's Avatar
    Join Date
    Jul 2002
    Location
    Where you live.
    Posts
    591
    VB Code:
    1. ' Find last real column that contains a value.
    2. intLastCol = ActiveSheet.Cells.Find(What:="*", _
    3.     LookIn:=xlValues, _
    4.     SearchDirection:=xlPrevious, _
    5.     SearchOrder:=xlByColumns).Column
    6.  
    7. ' Select next column.
    8. Columns(intLastCol + 1).Select
    Change the value of LookIn to xlFormulas if you want to find the last column with a formula.

Posting Permissions

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



Click Here to Expand Forum to Full Width