Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting and retaining an input variable ARGT Excel Discussion (Misc queries) 4 June 26th 08 11:42 PM
Inserting rows at variable points Janet H[_2_] Excel Programming 4 September 8th 05 08:27 PM
Inserting Variable Number of Rows bundyloco[_7_] Excel Programming 2 August 29th 05 11:25 AM
Inserting a variable number of rows in a worksheet kls[_2_] Excel Programming 1 August 20th 04 01:47 PM
inserting a variable into VB edb Excel Programming 2 February 29th 04 12:39 PM


All times are GMT +1. The time now is 09:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"