Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Checking specific cell, and identifing how many rows in the sheet

Hi all,

I have the following code:

I would like to make the following alternations.

1. Instead of specifying where it should stop I would like this to be
the last row of the data on the Shift Change Request sheet.

2. The If statement is causing an error. I want it to check cell F10
to see if it has the value "Yes", and if it does execute Macro 3.

Sub Macro8()
'
' Macro8 Macro
'
'
'
Application.Run "'Shift Changes.xls'!Macro2"
For i = 1 To 10
If Sheets("Shift Change Request")!R[10]C[6]="Yes" Then
Application.Run "'Shift Changes.xls'!Macro3"
Sheets("Shift Change History").Select
End If
Next
Application.Run "'Shift Changes.xls'!Macro4"
End Sub

Any help is greatly appreciated.

Cheers,
Amy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Checking specific cell, and identifing how many rows in the sheet

Sub Macro8()

lastrow = Worksheets("Shift Change Request") _
.Cells(rows.count,6).End(xlup).row
Application.Run "'Shift Changes.xls'!Macro2"
Sheets("Shift Change History").Select
For i = 1 To LastRow
If Sheets("Shift Change Request").Cells(10,6).value ="Yes" Then
Application.Run "'Shift Changes.xls'!Macro3"
End If
Next
Application.Run "'Shift Changes.xls'!Macro4"
End Sub

is a guess. But I don't see the utility of running Shift
Changes.xls!Macro3 for as many times as there are rows of data in Shift
Change Request. You don't use the loop variable at all, so maybe there
should be some code changing the activecell or something.

--
Regards,
Tom Ogilvy


"Amy" wrote in message
om...
Hi all,

I have the following code:

I would like to make the following alternations.

1. Instead of specifying where it should stop I would like this to be
the last row of the data on the Shift Change Request sheet.

2. The If statement is causing an error. I want it to check cell F10
to see if it has the value "Yes", and if it does execute Macro 3.

Sub Macro8()
'
' Macro8 Macro
'
'
'
Application.Run "'Shift Changes.xls'!Macro2"
For i = 1 To 10
If Sheets("Shift Change Request")!R[10]C[6]="Yes" Then
Application.Run "'Shift Changes.xls'!Macro3"
Sheets("Shift Change History").Select
End If
Next
Application.Run "'Shift Changes.xls'!Macro4"
End Sub

Any help is greatly appreciated.

Cheers,
Amy



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Checking specific cell, and identifing how many rows in the sheet

Sub Macro8()
'
' Macro8 Macro
'
'
'
Application.Run "'Shift Changes.xls'!Macro2"
For i = 1 To Sheets("Shift Change Request").UsedRange.Rows.Count
If Sheets("Shift Change Request").Range("F10").Value = "Yes" Then
Application.Run "'Shift Changes.xls'!Macro3"
Sheets("Shift Change History").Select
End If
Next
Application.Run "'Shift Changes.xls'!Macro4"
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Amy" wrote in message
om...
Hi all,

I have the following code:

I would like to make the following alternations.

1. Instead of specifying where it should stop I would like this to be
the last row of the data on the Shift Change Request sheet.

2. The If statement is causing an error. I want it to check cell F10
to see if it has the value "Yes", and if it does execute Macro 3.

Sub Macro8()
'
' Macro8 Macro
'
'
'
Application.Run "'Shift Changes.xls'!Macro2"
For i = 1 To 10
If Sheets("Shift Change Request")!R[10]C[6]="Yes" Then
Application.Run "'Shift Changes.xls'!Macro3"
Sheets("Shift Change History").Select
End If
Next
Application.Run "'Shift Changes.xls'!Macro4"
End Sub

Any help is greatly appreciated.

Cheers,
Amy



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Checking specific cell, and identifing how many rows in the sheet

Thanks Tom, this works wonderfully. The row is moved by Macro 3, so
the variables don't need to be changed.

Cheers,
Amy

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
copy rows to new sheet based on specific cell value dlballard Excel Worksheet Functions 5 April 24th 23 11:44 AM
import data from txt to specific col & rows in sheet programmer Excel Discussion (Misc queries) 0 July 21st 05 04:19 PM
make a macro to move specific rows to another sheet braxton Excel Worksheet Functions 1 February 21st 05 09:01 PM
Checking a cell for a specific color in Excel VBA ColdCore Excel Programming 1 January 20th 04 09:31 PM
Copying specific rows from one sheet to another Chris Excel Programming 2 October 17th 03 11:40 PM


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