+ Reply to Thread
Results 1 to 8 of 8

how to find first blank cell in column then copy all preceding cells

  1. #1
    Registered User
    Join Date
    07-25-2013
    Location
    California, United States
    MS-Off Ver
    Excel 2003
    Posts
    7

    how to find first blank cell in column then copy all preceding cells

    Hi all,

    I am working with arrays that extend far beyond their actual content, and so i am looking for a way, through macros, to find the first blank cell in a column and then copy all preceding cells in that column. Thank you!

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: how to find first blank cell in column then copy all preceding cells

    Try this...

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    07-25-2013
    Location
    California, United States
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: how to find first blank cell in column then copy all preceding cells

    So the only thing is there are multiple columns in this array and so finding the first blank in the whole array won't necessarily mean finding the first blank in the column that I want, unless I interpreted the code wrongly. Or do you mean that I should replace "A' with index of whichever column I want?

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: how to find first blank cell in column then copy all preceding cells

    Quote Originally Posted by an0593 View Post
    Or do you mean that I should replace "A' with index of whichever column I want?
    Yes replace the A to your desired Column...

  5. #5
    Registered User
    Join Date
    07-25-2013
    Location
    California, United States
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: how to find first blank cell in column then copy all preceding cells

    Is there any way to do the same thing if I don't have the column letter but only have the column number?

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: how to find first blank cell in column then copy all preceding cells

    cells(RowNumber,ColumnNumber)

    So A1 can be written as cells(1,1)

    Range("A:A").Find("")

    can be written as columns(1).Find("")

  7. #7
    Registered User
    Join Date
    07-25-2013
    Location
    California, United States
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: how to find first blank cell in column then copy all preceding cells

    Thanks! I was also having some problems with the following code:

    Range("A2:CN750").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Sheet8").Select
    Range("A2:CN750").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=True

    This is giving me errors when I try to paste, and it suggests I either select a single cell or the range of the same size, but it doesn't seem to be working for me

  8. #8
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: how to find first blank cell in column then copy all preceding cells

    Try this...

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    07-25-2013
    Location
    California, United States
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: how to find first blank cell in column then copy all preceding cells

    THank you! I am also trying to search for an instance of a specific word in an arrray but my code does not seem to work.

    'first i get the text i want to search for from another sheet
    Sheets("AdjustBaseEnv").Select
    Range("C16").Select
    Selection.Copy

    'then i paste it on to the sheet i want to look for so I can use it in the find function
    Sheets("Sheet8").Select
    Range("AJ2").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Application.CutCopyMode = False
    Dim selectedcurv As String

    'then i save it as a stirng in the code so i can refer to it in the find function
    selectedcurve = Range("AJ2").Value

    'then i select a large range to search for it
    Range("A1:AN200").Select
    Cells.Find(What:=selectedcurv, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
    :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
    False, SearchFormat:=True).Activate

    I don't know exactly what I have done wrong but for some reason it just selects a cell in the second column that has no instance of the word!!

+ 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. [SOLVED] Find empty cell till next value merge or copy the respective cells in next column
    By rpriyadharsini1987 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-25-2013, 03:46 AM
  2. Find the value of the 2nd to last cell in a column that includes blank cells
    By LookIWashed4Supper in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-23-2013, 09:35 PM
  3. [SOLVED] Find first non-blank cell after a group of blanks copy offset cells, find next blank, loop
    By gwsampso in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-21-2012, 06:11 AM
  4. Replies: 9
    Last Post: 12-09-2011, 04:39 AM
  5. find last non blank cell in a column and copy paste in next row
    By prasad_tavva in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2007, 09:41 AM

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