ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   What is wrong with "c.Activate" (https://www.excelbanter.com/excel-discussion-misc-queries/190085-what-wrong-c-activate.html)

Ayo

What is wrong with "c.Activate"
 
For Each c In Worksheets("RFDS Tracker").Range("A4:A" & lastRow).Cells
If c.Value < "" Then
c.Activate

Jon Peltier

What is wrong with "c.Activate"
 
As Joel indicates, you can rewrite your code to eliminate "ActiveCell". The
only reason you may need to reference the Active Cell is in an application
where the user's selection of a particular cell influences the operation of
the procedure.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Joel" wrote in message
...
with Worksheets(1)
set MyRange = .Range(.Cells(c.row,"A"),.Cells(c.row,17))
MyRange.Copy Destination:=.Range("D15")
end with

"Ayo" wrote:

I need to use "active_cell = Application.ActiveCell.Address" and a lot of
code lines like this
"Worksheets(1).Range("D15").Value =
Application.ActiveCell.EntireRow.Cells(1, 17).Value"
that is why I figured I need to activate the cell

"Jon Peltier" wrote:

Is the worksheet active?

Can you do whatever you need to without activating each cell?
Activating
takes time and causes flashing of the screen while the code is running.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Ayo" wrote in message
...
For Each c In Worksheets("RFDS Tracker").Range("A4:A" &
lastRow).Cells
If c.Value < "" Then
c.Activate
.
.
ActiveWorkbook.SaveCopyAs folderPath & fileName & ".xls"
End If
Next c

I am getting an error on "c.Activate", what could be wrong?









All times are GMT +1. The time now is 03:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com