Basicly I have to copy formula from left to right.
Certain ranges contains values and formulas, let say as example (even there are many similar ranges, that is way I need VBA):
Range: A2:C10Column A is totaly values, which is OK
Column B currently has only values (this is subject of my wanted VBA)
Column C has both values and formula (formulas which I need and want to copy to column B) , but problem is there is not range of values and range of formula to simply copy formula to column B.
My proposed solution is VBA which give reference to this forum basicly should do:
With selected range in Column C, copy cells with formulas and go to similar range in column C and copypaste just formulas in rows where formulas were in column C.
Like: B2:B10 contains values
C2:C4 contains formulas
C5:C7 contains values
C8:C10 contains formulas
I want to select C2:C10, copy formulas and go to B2:B10, select it and copy paste only formulas to B2:B10, but leave values in rows where it is as in Column C.
My VBA is not working, so I need your help, here is it
Sub CopyFormulaFromLeftToRighInSelecltion()
Dim cel As Object
Set SelRange = Selection
Dim Message$, Title$, Default$, Answer$
Message = "Copy formulas from left to Right:"
Title = "I got help from mrexcel.com"
Answer = InputBox(Message, Title, Default)
For Each cel In Selection
If cel.Formula Then
cel.Copy
Destination:=Selection.cel.offset(0,-1)
End If
Next
End Sub
any other creative idea, or modification of solution would be greatfull
Certain ranges contains values and formulas, let say as example (even there are many similar ranges, that is way I need VBA):
Range: A2:C10Column A is totaly values, which is OK
Column B currently has only values (this is subject of my wanted VBA)
Column C has both values and formula (formulas which I need and want to copy to column B) , but problem is there is not range of values and range of formula to simply copy formula to column B.
My proposed solution is VBA which give reference to this forum basicly should do:
With selected range in Column C, copy cells with formulas and go to similar range in column C and copypaste just formulas in rows where formulas were in column C.
Like: B2:B10 contains values
C2:C4 contains formulas
C5:C7 contains values
C8:C10 contains formulas
I want to select C2:C10, copy formulas and go to B2:B10, select it and copy paste only formulas to B2:B10, but leave values in rows where it is as in Column C.
My VBA is not working, so I need your help, here is it
Sub CopyFormulaFromLeftToRighInSelecltion()
Dim cel As Object
Set SelRange = Selection
Dim Message$, Title$, Default$, Answer$
Message = "Copy formulas from left to Right:"
Title = "I got help from mrexcel.com"
Answer = InputBox(Message, Title, Default)
For Each cel In Selection
If cel.Formula Then
cel.Copy
Destination:=Selection.cel.offset(0,-1)
End If
Next
End Sub
any other creative idea, or modification of solution would be greatfull