• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Replacing a Range with another Range

El Jameo

New Member
Hey all.


So I'll try to explain this as best as I can. I want to make it so that a Range is replaced with another Range. So:


Sub TeamFillOuts()

If Range("C5") = "Go Ape" Then

Range("C7", "C9") = Range("$P$9", "$P$11")

End If

End Sub


If that makes sense. But it obviously doesn't work.


Also, is there an ElseIf function?


Thanks all.
 
Hi El,


Try this


Sub TeamFillOuts()

If Range("C5") = "Go Ape" Then

Range("C7").Value = Range("$P$9").Value

Range("C9").Value = Range("$P$11").Value

End If

End Sub


Thanks,

Suresh Kumar S
 
Hi El,


You can try this...


Sub TeamFillOuts()

If Range("C5") = "Go Ape" Then

Range("C7") = Range("P9")

Range("C9") = Range("P11")

End If

End Sub
 
Hi El Jameo,


Fortunately below is working.. as Gaps between you destination cell and source cell are same.. :)

[pre]
Code:
Sub TeamFillOuts()
If Range("C5") = "Go Ape" Then
Range("C7,C9").Formula = "=$P9"
Else
Range("C7,C9") = "Yes! There is a ELSE loop also available in Excel..:)"
End If
End Sub
[/pre]

By the way.. Welcome to the forum...

Regards,

Deb
 
Back
Top