Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
dim dim is offline
external usenet poster
 
Posts: 123
Default Specifying a row to delete???

Hi folks, this is knda like a follow on to a previous question that Pete UK
helped a bit with.

I have recorded the following macro but I need to change it since it doesn't
exactly do what I want:

Sub Macro3()
'
' Macro3 Macro
' Macro recorded 08/12/2007
'

'
Rows("7:7").Select
Selection.Delete Shift:=xlUp
Range("A1").Select
End Sub

I need to change it so that the user can specify which row number to delete
by entering a value in a cell:

Row (Value in cell A1) Select
Selection.Delete Shift: ....etc etc

How do I write the code to specify that instead of it saying to delete a
specific row such as the ("7:7"), it will delete the row according to the
number in a cell?

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 695
Default Specifying a row to delete???

this delete entire rownumber typed in A1

Sub test()
Rows(Cells(1, 1)).EntireRow.Delete
End Sub


"dim" skrev:

Hi folks, this is knda like a follow on to a previous question that Pete UK
helped a bit with.

I have recorded the following macro but I need to change it since it doesn't
exactly do what I want:

Sub Macro3()
'
' Macro3 Macro
' Macro recorded 08/12/2007
'

'
Rows("7:7").Select
Selection.Delete Shift:=xlUp
Range("A1").Select
End Sub

I need to change it so that the user can specify which row number to delete
by entering a value in a cell:

Row (Value in cell A1) Select
Selection.Delete Shift: ....etc etc

How do I write the code to specify that instead of it saying to delete a
specific row such as the ("7:7"), it will delete the row according to the
number in a cell?

Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Specifying a row to delete???

Too much code

Sub test()
Rows(Cells(1, 1).Value).Delete
End Sub

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"excelent" wrote in message
...
this delete entire rownumber typed in A1

Sub test()
Rows(Cells(1, 1)).EntireRow.Delete
End Sub


"dim" skrev:

Hi folks, this is knda like a follow on to a previous question that Pete
UK
helped a bit with.

I have recorded the following macro but I need to change it since it
doesn't
exactly do what I want:

Sub Macro3()
'
' Macro3 Macro
' Macro recorded 08/12/2007
'

'
Rows("7:7").Select
Selection.Delete Shift:=xlUp
Range("A1").Select
End Sub

I need to change it so that the user can specify which row number to
delete
by entering a value in a cell:

Row (Value in cell A1) Select
Selection.Delete Shift: ....etc etc

How do I write the code to specify that instead of it saying to delete a
specific row such as the ("7:7"), it will delete the row according to the
number in a cell?

Thanks.



  #4   Report Post  
Posted to microsoft.public.excel.misc
dim dim is offline
external usenet poster
 
Posts: 123
Default Specifying a row to delete???

Thanks folks, that worked a charm.

I edited it firstly to delete the row depending on the value from another
sheet in the same workbook, and I have that working ok.

But now I've been trying to get it to take the row number value from a
different workbook. I've tried different combinations but keep getting either
object or syntax errors. Here's my most recent effort of converting it to
take the other workbooks value:

Sub test()
Rows("Book3.xls".Sheet1.Cells(1, 1).Value).Delete
End Sub

The code is obviously located in a module for Book 2 (Not book 3) which has
the rows I want to delete and Book 3 is open while running the code.

I prefer to figure things out myself through trial and error, and have tried
editing this code a variety of ways, but I'm just missing something and can't
put my finger on it! Can you give me some guidance on where I'm now going
wrong with this?

Thanks.
  #5   Report Post  
Posted to microsoft.public.excel.misc
dim dim is offline
external usenet poster
 
Posts: 123
Default Specifying a row to delete???

Bump.



"dim" wrote:

Thanks folks, that worked a charm.

I edited it firstly to delete the row depending on the value from another
sheet in the same workbook, and I have that working ok.

But now I've been trying to get it to take the row number value from a
different workbook. I've tried different combinations but keep getting either
object or syntax errors. Here's my most recent effort of converting it to
take the other workbooks value:

Sub test()
Rows("Book3.xls".Sheet1.Cells(1, 1).Value).Delete
End Sub

The code is obviously located in a module for Book 2 (Not book 3) which has
the rows I want to delete and Book 3 is open while running the code.

I prefer to figure things out myself through trial and error, and have tried
editing this code a variety of ways, but I'm just missing something and can't
put my finger on it! Can you give me some guidance on where I'm now going
wrong with this?

Thanks.

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
delete the test values, but do not delete the formulas kathy Excel Discussion (Misc queries) 1 February 21st 07 07:03 PM
How can I delete a macro when the Delete button is not active? FCR Excel Worksheet Functions 0 March 9th 06 09:43 AM
How to Delete a Range in Closed Workbook (to Replace Delete Query) [email protected] Excel Discussion (Misc queries) 1 March 8th 06 10:10 AM
How do i delete a macro in Excel 2003 when delete isn't highlight Abel Excel Discussion (Misc queries) 2 September 13th 05 04:09 AM
How to delete rows when List toolbar's "delete" isnt highlighted? Linda Excel Worksheet Functions 1 May 26th 05 08:39 PM


All times are GMT +1. The time now is 04:05 PM.

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"