View Single Post
  #15   Report Post  
Posted to microsoft.public.excel.misc
David
 
Posts: n/a
Default delete all matching rows

Don,
You seem to have a real command of this subject and I need some help. I'm
creating a consolidated workbook of data that is imported from multiple sites
each week. Sheet1 is graphs, so nothing to do with this. Sheet2 is the Master
List of locations, column A is location number, column B is location name.
Starting with Column 3 are ending dates for each week (Sundays). There are 15
pages, each with one datapoint from the location reports (which has 15 totals
that I'm posting from like Daily Sales Total, on one sheet, Calls Run, on
another sheet, etc.). The macro copies datapoint1 from the location's report,
goes to the consolidated workbook, sheet2 and finds the cell that intersets
with the location number and the date from the location report and writes the
result. It does this 15 times, one datapoint per sheet with each datapoint,
moving to the next sheet.
My problem comes when I need to add a new location or need to sort the data.
I have started with giving range A1:B200 a range name (NameList) and then
using the formula =IF(Sheet1!A1="","",OFFSET(NameList,0,0)) on the following
sheets. But, as I started testing, this works great on the first two columns,
so that if I enter a row and put new data, the number and name are correct (I
have a macro that autofills if any changes are made on the first sheet), but
all the other columns are of course not affected.
What I'm really after is to have sheet2 be my master sheet and the other 14
sheets "act" like sheet2 for columns A & B and then all the data for each
week stay on the same row for the location. If I insert a row, I want all
sheets to have a row inserted. If I sort sheet2 (always by columns 1 and 2),
I want all sheets to be sorted the same way, along with all the corresponding
data.
I saw your option of highlighing all sheets, and inserting or deleting a
row. This would be perfect until I get to the sorting part. Would you have a
macro solution, or is there a better approach to what I'm trying to do.

Thanks much and hope you have a Great Christmas!

"Don Guillett" wrote:

try this. Correct word wrap and add the other months. NO selections
necessary or desired so no screen updating.

Sub DeleteRequestedRowsInAllSheets()
Dim sh As Worksheet
x = InputBox("Put in Row NUMBER to Delete")

Resp = MsgBox(Prompt:="This Action Will Reset All Pre Entered Data For This
Employee Continue?", Buttons:=vbYesNo)
If Resp = vbNo Then Exit Sub
Resp = MsgBox(Prompt:="Are You Sure You Want To Continue - This Action Can
Not Be Undone", Buttons:=vbYesNo)
If Resp = vbNo Then Exit Sub

For Each sh In Worksheets(Array("Jan", "Feb", "Overview"))
sh.Rows(x).Delete
Next sh

End Sub


--
Don Guillett
SalesAid Software

"Rich" wrote in message
...
at the min i am using the following:-

Sub line9()
Resp = MsgBox(Prompt:="This Action Will Reset All Pre Entered Data For
This
Employee Continue?", Buttons:=vbYesNo)
If Resp = vbNo Then Exit Sub
Resp = MsgBox(Prompt:="Are You Sure You Want To Continue - This Action Can
Not Be Undone", Buttons:=vbYesNo)
If Resp = vbNo Then Exit Sub
Application.ScreenUpdating = False
Sheets(Array("Jan", "Feb", "March", "April", "May", "June", "July", "Aug",
"Sep", "Oct", _
"Nov", "Dec")).Select
Range("E9:AI9").Select
Selection.ClearContents
Sheets("Overview").Select
Range("B9:E9").Select
Selection.ClearContents
Range("B9").Select
Application.ScreenUpdating = True
End Sub

using this macro i would have to write it approx 130 times down the main
page next to each persons name. i was hoping to be able to do a "one hit"
button which when i click on it, it will ask me which row to delete rather
than having 130 macros saying the same thing