+ Reply to Thread
Results 1 to 5 of 5

Newbie questions - probably simple

Hybrid View

  1. #1
    Sonnich
    Guest

    Newbie questions - probably simple

    Hi!

    I have an excel doc, with a button, for which I need to know:

    I need to open another file, which I like this
    Workbooks.Open ("C:\test\somefile.xls")
    - Is there a way that I can prompt for the filename?

    The I copy data from that into my document. Like this

    Workbooks(1).Sheets(1).Cells(i, j) =
    Workbooks(2).Sheets(1).Cells(i, j)
    Workbooks(1).Sheets(1).Cells(i, j).Font.Bold =
    Workbooks(2).Sheets(1).Cells(i, j).Font.Bold

    - How can I copy the widths of the cells, and the border (if any)?

    And finally:

    Is there a way to delete an entite row? (or coloumn?)

    Is there a way to move/copy a row or coloumn?

    BR
    Sonnich


  2. #2
    Bob Phillips
    Guest

    Re: Newbie questions - probably simple



    "Sonnich" <sonnich.jensen@elektrobit.com> wrote in message
    news:1145890981.311818.306140@v46g2000cwv.googlegroups.com...
    > Hi!
    >
    > I have an excel doc, with a button, for which I need to know:
    >
    > I need to open another file, which I like this
    > Workbooks.Open ("C:\test\somefile.xls")
    > - Is there a way that I can prompt for the filename?


    Look at GetOpenFilename in VBA Help

    > The I copy data from that into my document. Like this
    >
    > Workbooks(1).Sheets(1).Cells(i, j) =
    > Workbooks(2).Sheets(1).Cells(i, j)
    > Workbooks(1).Sheets(1).Cells(i, j).Font.Bold =
    > Workbooks(2).Sheets(1).Cells(i, j).Font.Bold
    >
    > - How can I copy the widths of the cells, and the border (if any)?


    Workbooks(1).Sheets(1).Cells(i, j).Copy
    Workbooks(2).Sheets(1).Cells(i, j).Paste PasteSpecial:=xlPasteAll



  3. #3
    Sonnich
    Guest

    Re: Newbie questions - probably simple

    > > I need to open another file, which I like this
    > > Workbooks.Open ("C:\test\somefile.xls")
    > > - Is there a way that I can prompt for the filename?

    > Look at GetOpenFilename in VBA Help


    Thanks that worked


    > > The I copy data from that into my document. Like this
    > > Workbooks(1).Sheets(1).Cells(i, j) =
    > > Workbooks(2).Sheets(1).Cells(i, j)
    > > Workbooks(1).Sheets(1).Cells(i, j).Font.Bold =
    > > Workbooks(2).Sheets(1).Cells(i, j).Font.Bold
    > > - How can I copy the widths of the cells, and the border (if any)?

    > Workbooks(1).Sheets(1).Cells(i, j).Copy
    > Workbooks(2).Sheets(1).Cells(i, j).Paste PasteSpecial:=xlPasteAll


    It works,, but I resizes all the cells into something odd, even the
    height changes. Besides it does not look good when working.
    I found this to work, but I still need to get the coloumn widths
    correctly.
    Workbooks(2).Sheets(1).Range("a1:h31").Copy
    (Workbooks(1).Sheets(1).Range("a1"))

    BESIDES, I'd like to know:

    1) how can I delete an entire row (e.g. 16)?

    2) how do I know the size of my sheet? For some H is the last one used,
    for others I or L. There must be a function for this.

    3) is there a way to move an entire coloumn, or insert one? Or to
    delete one (same as row I asume)?

    BR
    Sonnich


  4. #4
    Valued Forum Contributor
    Join Date
    04-11-2006
    Posts
    407
    I can answer 1 and 3 easily enough:

    1) Rows("16:16").EntireRow.Delete
    2) I'll let someone else explain this one. My methods for this are very primative.
    3) Columns("E:E").EntireColumn.Insert
    Columns("H:H").EntireColumn.Cut Destination:=Columns("E:E").EntireColumn. _
    EntireColumn

    Hope that helps.

    -Ikaabod


    Quote Originally Posted by Sonnich
    > >

    BESIDES, I'd like to know:

    1) how can I delete an entire row (e.g. 16)?

    2) how do I know the size of my sheet? For some H is the last one used,
    for others I or L. There must be a function for this.

    3) is there a way to move an entire coloumn, or insert one? Or to
    delete one (same as row I asume)?

    BR
    Sonnich

  5. #5
    jodleren
    Guest

    Re: Newbie questions - probably simple

    One more to go...

    I can set a string, but how do I set a number as it was a string, like:

    Workbooks(1).Sheets(1).Cells(i, j) = "Hello world"

    and

    Workbooks(1).Sheets(1).Cells(i, j) = "1." ' this is some kind of
    header

    BR
    Sonnich


+ 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