INSERT ROW
INSERT ROW
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: INSERT ROW

  1. #1
    Guest

    Default

     
    I have the following macro: RowNum = Application.InputBox(Prompt:="Number you want to insert ?", Type:=1)
    Rows(RowNum).EntireRow.Insert
    Rows(RowNum).Select
    RowNum = Application.InputBox(Prompt:="What is the name ?", Type:=2)
    End If
    Range("A16") = InputBox("Input text to go in A16")

    My question: In this case I have insert row 16,but what if this is 25.Do I have to change everytime this macro with Range("A25")
    Can this not be variable.

  2. #2
    New Member
    Join Date
    Mar 2002
    Posts
    33
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I can think of a couple ways to do it. One way is after the "end if" type:
    Range("A1").Select
    For i = 1 to (RowNum-1)
    ActiveCell.Offset(1, 0).Range("A1").Select
    Next i
    ActiveCell.Value = InputBox("Input text to go in A" & RowNum)

    Of course, you'll have to put in "Dim i as integer" at the top of your subroutine.

  3. #3
    Guest

    Default

    On 2002-03-13 12:45, tk19 wrote:
    I can think of a couple ways to do it. One way is after the "end if" type:
    Range("A1").Select
    For i = 1 to (RowNum-1)
    ActiveCell.Offset(1, 0).Range("A1").Select
    Next i
    ActiveCell.Value = InputBox("Input text to go in A" & RowNum)

    Of course, you'll have to put in "Dim i as integer" at the top of your subroutine.

  4. #4
    Guest

    Default

      
    On 2002-03-13 12:45, tk19 wrote:
    I can think of a couple ways to do it. One way is after the "end if" type:
    Range("A1").Select
    For i = 1 to (RowNum-1)
    ActiveCell.Offset(1, 0).Range("A1").Select
    Next i
    ActiveCell.Value = InputBox("Input text to go in A" & RowNum)

    Of course, you'll have to put in "Dim i as integer" at the top of your subroutine.
    Thanks for your answer.I have changed the
    ActiveCell.Value in ActiveCell.Text
    Is there a possibility that I get a message when I give a number in place of a text.
    Example : "This is not the right text"
    Many thanks

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com