DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 4 of 4 FirstFirst ... 234
Results 46 to 52 of 52

Thread: Several Excel VB Questions.

  1. #46
    Join Date
    Jun 2007
    Posts
    39
    MyNeoF changes.. Let me paste you the complete For Statement (Well what I've finished of it..)

    EndFrontRow is calculated by finding the last row of data In this case it's 60

    For MyNeof = 1 To EndFrontRow Step 3

    Sheets("Temp").Select
    Range("A" & MyNeof & "" & MyNeof).Cut Sheets("Temp2").Range("A1").Insert(xlShiftDown)
    Sheets("Temp2").Select
    Range("B1").Cut Range("A2")
    Range("C1").Cut Range("A3")
    Range("D1").Cut Range("A4")

    Range("A1").Select

    (It goes on to add info to Cells B1 - B4 )

  2. #47
    Join Date
    Mar 2005
    Location
    Los Angeles, Calif. AKA: Gangsta Yoda™
    Posts
    455
    But being dynamic is ok but are you getting the ange you are supossed to be getting?

    You are saying that this line is not performing correctly so anything else after that is irrelevant at this point.

    Range("A" & MyNeof & ":D" & MyNeof).Cut Sheets("Temp2").Range("A1").Insert(xlShiftDown)

    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer code questions via PMs.
    Microsoft MVP 2006-2009
    Office Development FAQ (VBA, VB6, VB.NET, C#)
    Software Engineer MCP (VB6 & .NET)
    Reps & Rating PostsVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6Outlook Global Address List

  3. #48
    Join Date
    Jun 2007
    Posts
    39
    it's not that it's not performing.. It's producing an Error.. I seperated them into two lines and it works properly..

    Code:
        Range("A" & MyNeof & ":D" & MyNeof).Cut
        Sheets("Temp2").Range("A1").Insert (xlShiftDown)
    Now it works

  4. #49
    Join Date
    Mar 2005
    Location
    Los Angeles, Calif. AKA: Gangsta Yoda™
    Posts
    455
    Ok now that that is said, the .Cut method takes an optional argument of the destination range to place the cut'd range.

    So you only6 needed to place this as th argument

    Range("A" & MyNeof & ":D" & MyNeof).Cut Sheets("Temp2").Range("A1")
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer code questions via PMs.
    Microsoft MVP 2006-2009
    Office Development FAQ (VBA, VB6, VB.NET, C#)
    Software Engineer MCP (VB6 & .NET)
    Reps & Rating PostsVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6Outlook Global Address List

  5. #50
    Join Date
    Jun 2007
    Posts
    39
    Ok So I need to use two lines to ensure it uses Insert.. Now I have a new problem hehe

    Code:
    Range("I" & MyNeoB).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
    Gives the Error "PasteSpecial method of Range class failed"

    MyNeoB = 1 + 4 each time it runs.. Since the Cut cuts 4 lines I need it to move the paste Cell down by 4 cells at a time.. That keeps them in order.


    I tried it as

    Code:
    Range("I1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
    And got the Exact same error. I need it to paste the Values.. not the Formulas that are there...

  6. #51
    Join Date
    Jun 2007
    Posts
    39
    That must be an old command Seems I can't use this book for reference lol Cause

    Code:
    Range("D1:D4").Copy
    Range("I" & MyNeoB).PasteSpecial xlPasteValues, xlPasteSpecialOperationNone, SkipBlanks
    Works Properly..

  7. #52
    Join Date
    Mar 2005
    Location
    Los Angeles, Calif. AKA: Gangsta Yoda™
    Posts
    455
    What version does the book cover? If you want to know if a funciton is available in a specific version of Excel usually a MSDN search will turn up the function in the latest Excel version so you will have to specify the exact Excel version in the search too.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer code questions via PMs.
    Microsoft MVP 2006-2009
    Office Development FAQ (VBA, VB6, VB.NET, C#)
    Software Engineer MCP (VB6 & .NET)
    Reps & Rating PostsVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6Outlook Global Address List

Similar Threads

  1. VB to excel export
    By Ananthakrishnan in forum VB Classic
    Replies: 3
    Last Post: 05-20-2005, 11:01 AM
  2. Excel and VB
    By svn in forum VB Classic
    Replies: 6
    Last Post: 05-17-2005, 09:55 AM
  3. They created J#, why couldn't they do VB#?
    By Thomas Eyde in forum .NET
    Replies: 290
    Last Post: 12-22-2001, 03:13 PM
  4. Replies: 84
    Last Post: 01-29-2001, 02:12 PM
  5. Re: VB or Powerbuilder?
    By Jean-Yves in forum Enterprise
    Replies: 3
    Last Post: 06-01-2000, 12:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center