Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
sub changeto1quickly()
range("C1").Value = 1
sleep(1)
("C1").Value= 0
End sub
above works to change C1 to 1 then pause it then revert it to 0 so now I need to aggregate this across a column where the offset contains a reference
I need to be able to change the value of the cells offset to the left of a column containing a certain word. For example in COLUMNS C
and D
so that every cel in column B that has Dim I need to run the above sub to quickly changes the zeros to ones.
B D E
1 dim 0
dim 0
car 0
car 0
dim 0
car 0
I need to be able to make a VBA formula that would do pretty much what any excel if formula would do if you dragged it down. I found this here: http://www.quepublishing.com/articles/article.aspx?p=2021718&seqNum=8 Suppose you have a list of produce in column A with totals next to them in column B. If you want to find any total equal to zero and place LOW in the cell next to it, do this:
Set Rng = Range("B1:B16").Find(What:="0", LookAt:=xlWhole, LookIn:=xlValues)
Rng.Offset(, 1).Value = "LOW"
Although I'd need it set out slightly differently not referring to column A or B from A but to a non adjacent column . I.e to check is D:D has Dim then put 1 in any cell that does in column C:C offset to coumn D:D surely this can be adjusted for what I need. Maybe..
as a sub
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
sub pump_onall()
Set Rng = Range("B1:B16").Find(What:="Dim", LookAt:=xlWhole, LookIn:=xlValues)
Rng.Offset(3, 0).Value = 1
sleep(1)
Rng.Offset(3,0).Value = 0
End sub
I get the error on the set Rng line
Sub pump_onall()
Set Rng = Sheets("Account Details --->").Range("DH1:DH50").Value.Find(What:="DQ3", LookAt:=xlWhole, LookIn:=xlValues)
Rng.Offset(0, -7).Value = 1
Sleep (1)
Rng.Offset(0, -7).Value = 0
End Sub
Surely this can work
Sub pump_onall()
Sheets("Account Details --->").Range("DH1:DH50").Value.Find(What:="DQ3", LookAt:=xlWhole, LookIn:=xlValues)
Sheets("Account Details --->").Range("DH1:DH50").Offset(0, -7).Value = 1
Sleep (1)
Sheets("Account Details --->").Range("DH1:DH50").Offset(0, -7).Value = 0
End Sub
the error I get is error 9 subscript out of range