Results 1 to 4 of 4

Thread: Excel In Vb

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2002
    Location
    UK
    Posts
    49

    Cool Excel In Vb

    I have an excel spread sheet (which only has data in column 1) and would like to copy it another using common dialog boxes.

    Please help!
    Qwerty007
    UK

  2. #2
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    TIP: to find out the code for it...

    record what you want to do in a macro in excel, then look at the code produced...
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2002
    Location
    UK
    Posts
    49
    Tried that, there must be a simple way to copy everything in column one and paste it in an other application where there is a free space.
    Qwerty007
    UK

  4. #4
    Addicted Member Supester's Avatar
    Join Date
    Nov 2001
    Location
    The Netherlands
    Posts
    220
    Try this....it will test your column.....it is slow as it will test all cells for a value

    Sub Macro1()
    Dim rngRange As Range
    Dim bEmpty As Boolean
    Dim iCounter As Integer



    Set rngRange = Selection
    bEmpty = True

    For iCounter = Asc("A") To Asc("Z")
    Sheets("Sheet1").Columns(Chr(iCounter) & ":" & Chr(iCounter)).Select
    While bEmpty
    For Each rngRange In Selection
    Application.StatusBar = rngRange.Address
    DoEvents
    If rngRange <> "" Then
    bEmpty = False
    MsgBox " FOUND VALUE"
    Exit For
    Else
    'Do nothing
    End If
    Next
    Wend

    If bEmpty Then
    Exit For
    Else
    bEmpty = True
    End If
    Next

    MsgBox "column" & Selection.Column & " is empty"
    End Sub

    Another possibility:

    Selection.SpecialCells(xlCellTypeLastCell).Select

    This selects the last used cell....meaning the next row (to be retrieved with the selection object) will be empty
    We have the technology and we are not afraid to use it

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