Macro to Paste One Cell to Right

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

COLLINSM45

Thread Starter
Joined
Dec 20, 2010
Messages
4
Operating system: windows vista
Computer: Dell 1737 studio
Software: Microsoft Excel 2007
Concern: I created a chart that have the price in a row that changes daily and want to create a macro that will paste this price
from another worksheet cell to the right from the last used cell in the chart worksheet.
Sample:
SELECT_COPY_PASTE_PRICE Macro:

Data in worksheet "AEEQUERY" cell "G2" ($35.00)<this price
I want to paste in worksheet "AEE" .....row C7,
if C7 is blank, if C7 isn't blank, paste in C8, if C8 is blank, if C8 isn't blank, paste in C9, "..paste one cell to the right from the last used cell in row.

Any help greatly appreciated.
'
 
Joined
Jul 1, 2005
Messages
8,546
Welcome to the board.

Your description's a bit confusing. The code below is adapted from a thing by Ron de Bruin here. It will copy to the first free cell in row 7. Note that no selecting is involved. Make sure the "source" worksheet is active when you run it.

Sub LastColumnInOneRow()
'Find the last used column in a Row: row 7 in this example
Dim LastCol As Integer
With Sheets("ADOBE")
LastCol = .Cells(7, .Columns.Count).End(xlToLeft).Column
End With

Range("G2").Copy Sheets("ADOBE").Cells(7, LastCol + 1)
End Sub
 

COLLINSM45

Thread Starter
Joined
Dec 20, 2010
Messages
4
Welcome to the board.

Your description's a bit confusing. The code below is adapted from a thing by Ron de Bruin here. It will copy to the first free cell in row 7. Note that no selecting is involved. Make sure the "source" worksheet is active when you run it.

Sub LastColumnInOneRow()
'Find the last used column in a Row: row 7 in this example
Dim LastCol As Integer
With Sheets("ADOBE")
LastCol = .Cells(7, .Columns.Count).End(xlToLeft).Column
End With

Range("G2").Copy Sheets("ADOBE").Cells(7, LastCol + 1)
End Sub
To remove some confusion, post was edited.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top