Tech Support Guy banner
Status
Not open for further replies.
1 - 3 of 3 Posts

·
Registered
Joined
·
4 Posts
Discussion Starter · #1 ·
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.
'
 

·
Registered
Joined
·
8,546 Posts
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
 

·
Registered
Joined
·
4 Posts
Discussion Starter · #3 ·
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.
 
1 - 3 of 3 Posts
Status
Not open for further replies.
Top