Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to test, copy, move, and paste cell value

Status
Not open for further replies.

bgarcia94550

Technical User
May 6, 2004
5
US
I'm new to VBA coding so please educate me. I'm looking to do the following:

Read a range of cells
If the active cell is > 1
Copy the cell
Move to another cell: offset(-3,-2)
Paste the value
Else
Read the next record


I started playing around and got the following code but it's not what I want


Sub Ben()
Selection.Copy
Range("C659").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub

 
hi,

Do you mean actually MOVE the data, which means to REMOVE it from one cell to another?

OR do you just want the COPIED to the other cell?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
generally...
Code:
dim r as range

for each r in range(selection, selection.end(xldown))
  with r
    if .value > 1 then
       .offset(-3,-2).value = .value
    end if
  end with
next


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top