LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
associates
 
Posts: n/a
Default insert a new row in VB


Hi,

I was wondering if anyone might be able to help me here.

How do i insert a new row in a worksheet in excel using VB programming?


For example, in a worksheet called Data, the following is the data

A B C
1 Merchandise 500 600
2 02-000 200 200
3 02-001 300 600
4 Total 1000 1400
5 Grocery 200 80
6 03-001 200 200
7 ...

I'd like to be able to insert a new row after "Total" which is after
line no. 4, just to separate them between merchandise and grocery
(formatting issue).

I've got some codes but not working really yet (got some errors)

If insertnewline = True Then
Worksheets("Data").Range("A4").Select
Selection.Insert Shift:=xlDown
end if

The error message that i got is
run-time error '1004'
select method of range class failed

I don't know why it doesn't like the range.

Your help is greatly appreciated.

Thank you in advance


--
associates
------------------------------------------------------------------------
associates's Profile: http://www.excelforum.com/member.php...o&userid=35073
View this thread: http://www.excelforum.com/showthread...hreadid=548249

 
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
How do I insert a reference to lookup and insert a name Jan K New Users to Excel 3 July 20th 05 10:39 AM
insert picture BillGwyer Excel Discussion (Misc queries) 1 March 4th 05 06:37 PM
Insert Line Macro Spyder Excel Discussion (Misc queries) 1 March 3rd 05 12:17 AM
Challenging Charting C TO Charts and Charting in Excel 0 January 17th 05 06:57 PM
Function to automatically insert a new sheet as a result of data entry? Mark Mulik Excel Worksheet Functions 2 November 28th 04 02:21 AM


All times are GMT +1. The time now is 03:30 AM.

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

About Us

"It's about Microsoft Excel"