![]() |
Using variable name as a value for inserting a row
Hi guys and girls, Could anyone help me please. I am trying to insert a new row using a variable called "countrytotal". The idea is to add all the rows where there is data (which I have done and is stored in "countrytotal") and then use the value of "countrytotal" + 1 to insert the next row for new data to be added. To do it using numbers it's: Rows("6:6").Select Selection.Insert Shift:=xlDown but I want to replace the "6:6" with the variable "countrytotal" if it is possible. Any help will be very much appreciated. Thanks, T8RSP -- T8RSP ------------------------------------------------------------------------ T8RSP's Profile: http://www.excelforum.com/member.php...o&userid=28452 View this thread: http://www.excelforum.com/showthread...hreadid=482215 |
Using variable name as a value for inserting a row
If I understand correctly, I think the syntax you are looking for is
something like: Rows(CountryTotal & ":" & CountryTotal).Insert Shift:=xlDown HTH/ "T8RSP" wrote: Hi guys and girls, Could anyone help me please. I am trying to insert a new row using a variable called "countrytotal". The idea is to add all the rows where there is data (which I have done and is stored in "countrytotal") and then use the value of "countrytotal" + 1 to insert the next row for new data to be added. To do it using numbers it's: Rows("6:6").Select Selection.Insert Shift:=xlDown but I want to replace the "6:6" with the variable "countrytotal" if it is possible. Any help will be very much appreciated. Thanks, T8RSP -- T8RSP ------------------------------------------------------------------------ T8RSP's Profile: http://www.excelforum.com/member.php...o&userid=28452 View this thread: http://www.excelforum.com/showthread...hreadid=482215 |
Using variable name as a value for inserting a row
Another possible method:
Rows(CountryTotal).EntireRow.Insert Shift:=xlDown HTH/ "T8RSP" wrote: Hi guys and girls, Could anyone help me please. I am trying to insert a new row using a variable called "countrytotal". The idea is to add all the rows where there is data (which I have done and is stored in "countrytotal") and then use the value of "countrytotal" + 1 to insert the next row for new data to be added. To do it using numbers it's: Rows("6:6").Select Selection.Insert Shift:=xlDown but I want to replace the "6:6" with the variable "countrytotal" if it is possible. Any help will be very much appreciated. Thanks, T8RSP -- T8RSP ------------------------------------------------------------------------ T8RSP's Profile: http://www.excelforum.com/member.php...o&userid=28452 View this thread: http://www.excelforum.com/showthread...hreadid=482215 |
Using variable name as a value for inserting a row
Thanks for that Quartz - it did the trick -- T8RS ----------------------------------------------------------------------- T8RSP's Profile: http://www.excelforum.com/member.php...fo&userid=2845 View this thread: http://www.excelforum.com/showthread.php?threadid=48221 |
All times are GMT +1. The time now is 04:38 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com