Query on Ranges

sylvest

New Member
Joined
Sep 15, 2006
Messages
46
Hi,

I need help on the following:

I have a workbook - rainy.xls
worksheets inside the workbook - red,blue,yellow

the active worksheet now is blue.

I need to know single line statement to accomplish the following:

How change the value of cell A1 of yellow of rainy.xls to 28 if the active worksheet is currently unknown ?

tks
 

Some videos you may like

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

jindon

MrExcel MVP
Joined
Aug 21, 2004
Messages
16,995
Hi
try
Code:
workbooks("rainy.xls").sheets("yellow").range("a1").value=28
 

venkat1926

Well-known Member
Joined
Aug 21, 2005
Messages
4,824
try something like this macro

Sub test()
Dim x As Worksheet
For Each x In ThisWorkbook.Worksheets
If x.Cells.Interior.ColorIndex = 4 Then
x.Select
Range("a1").Select
Exit Sub
End If
Next
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,109,464
Messages
5,528,957
Members
409,848
Latest member
Blomsten
Top