View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Xxer Xxes Xxer Xxes is offline
external usenet poster
 
Posts: 33
Default Avoid ,,Select" and ,,Selection" in a few lines of code

Pe duminică, 6 decembrie 2020, la 05:44:56 UTC+2, Xxer Xxes a scris:
I repost some lines of code :

With DestWks
For Each myCell In myRng1.Cells
If myCell < 3 Then
myCell = myCell.Value + 1


is wrong . I need if in myCell value is < 3 ,
then , myCell.Offset(0, -4 ) to increment its own value
with value ,,1" ;
so , if in myCell.Offset(0,-4) the value is 235 , it must became
236 ;

now, i have this line of code, but i doesnt do the task I need :
For Each myCell In myRng1.Cells
If myCell < 3 Then
myCell.Offset(0, -4).Value = Value + 1



i cant figure it out .