Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
move to next row
I have a spreadsheet that calculates hours based on an associates
schedule. It is setup with two rows to one set of data. The first cell merges the top and bottom row and contains the employees name while the remaining cells stay seperate. So that I may enter start and end shift times for each day of the week. I have a form that is used when an employee leaves the company. You type in the name and it searches for that employee and deletes the name. I also want it to delete any time records that still exist. When the code searches for the name it selects the cell the name was in. I then try to clear the time data but it only clears the top row. I have tried using .offset(1,0) but it goes down to the next employee. I know this is a lot for a description so let me know if I can clarify. Here is the relevant code: The first part of the code searches a "source"sheet for the name of the employee and deletes it then hides the row Private Sub btnRem_Click() Application.ScreenUpdating = False Sheets(2).Cells(1, 1).Activate On Error GoTo b Cells.Find(What:=txtName.Value, After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate Selection.Value = "" Sheets(Array("Payroll Info", "Store Schedule")).Select Selection.EntireRow.Hidden = True Then I switch to the sheet that contains the time data. The cell that is already selected is highlighted and from there i select the entirerow Sheets(1).Activate Selection.Activate Selection.EntireRow.Select This is where my problem lies This part works Selection.Cells(2).Value = "" Selection.Cells(3).Value = "" Selection.Cells(4).Value = "" Selection.Cells(5).Value = "" Selection.Cells(6).Value = "" Selection.Cells(7).Value = "" Selection.Cells(8).Value = "" This Part does not. It goes down to the next employee. ActiveCell.Offset(1, 0).EntireRow.Select Selection.Cells(2).Value = "" Selection.Cells(3).Value = "" Selection.Cells(4).Value = "" Selection.Cells(5).Value = "" Selection.Cells(6).Value = "" Selection.Cells(7).Value = "" Selection.Cells(8).Value = "" 'Selection.EntireRow.Hidden = True 'txtName.Value = "" 'Sheets(2).Activate Application.ScreenUpdating = True Exit Sub b: MsgBox "That associate does not exist. Please double check the spelling as it appears on the schedule and try again", vbExclamation, "Invalid Associate" ' txtName.Value = "" End Sub What should I do? Let me know what additional info you need. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel arrows don't move black box but move the window | Excel Discussion (Misc queries) | |||
Can I Move replace instead of Move copy | Excel Discussion (Misc queries) | |||
excel-how to get the spreadsheet to move as I move the scroll tab | Excel Discussion (Misc queries) | |||
How do I stop making the spreadsht move when I move up/dwn/lt/rt? | Excel Worksheet Functions | |||
When I move scroll bar in excell the contents do not move with it | Excel Discussion (Misc queries) |