Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default 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
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
Excel arrows don't move black box but move the window Thebit Excel Discussion (Misc queries) 1 April 13th 09 02:06 AM
Can I Move replace instead of Move copy [email protected] Excel Discussion (Misc queries) 2 January 9th 08 10:25 PM
excel-how to get the spreadsheet to move as I move the scroll tab excel toiler Excel Discussion (Misc queries) 6 November 7th 07 06:07 PM
How do I stop making the spreadsht move when I move up/dwn/lt/rt? Manny Excel Worksheet Functions 4 April 7th 06 10:30 PM
When I move scroll bar in excell the contents do not move with it ramneek Excel Discussion (Misc queries) 2 June 29th 05 07:35 PM


All times are GMT +1. The time now is 05:57 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"