Results 1 to 9 of 9

Thread: suggest the mistake in this macro part

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Member
    Join Date
    Jun 2012
    Posts
    39
    Rep Power
    0
    Below is the vba code for copying a data and then pasting it at the next empty line after the present data and then deleting the original data so that when i come back next time i can input data in the sheet again and do it again and again.

    one problem is when it is my first time it goes to the end of the column b. so i wanted to keep a check and do it accordingly. Can you recommend the code for me? thanks

    Code:
    Sub Macro1()
        Dim jpt As Worksheet
        Dim i As Worksheet
        Dim sheet1 As Worksheet
        
        Sheets("jpt").Activate
        Sheets("jpt").Range("b3").Select
        Range(Selection, Selection.End(xlToRight)).Select
        Range(Selection, Selection.End(xlDown)).Select
        Selection.Copy
        
        Sheets("i").Activate
        Range("B3").Select
        If Selection.Offset(1, 0) = "" Then
        ActiveSheet.paste
        Else
        Selection.End(xlDown).Offset(1, 0).Select
        ActiveSheet.paste
        End If
            
        Sheets("jpt").Activate
        Sheets("jpt").Range("b3").Select
        Range(Selection, Selection.End(xlToRight)).Select
        Range(Selection, Selection.End(xlDown)).Select
        Selection.Delete
    End Sub
    Last edited by Excel Fox; 04-02-2013 at 06:14 PM. Reason: Code Tags

Similar Threads

  1. Suggest the mistake in the formula
    By Safal Shrestha in forum Excel Help
    Replies: 2
    Last Post: 04-21-2013, 09:42 AM
  2. Replies: 2
    Last Post: 04-16-2013, 01:36 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
  •