![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
New Member
Join Date: Mar 2002
Posts: 33
|
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 | |
|
Guest
Posts: n/a
|
Quote:
|
|
|
|
|
#4 | |
|
Guest
Posts: n/a
|
Quote:
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 |
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|