ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   sheets.range and adding cells that are out of the range (https://www.excelbanter.com/excel-programming/282821-sheets-range-adding-cells-out-range.html)

Phillips

sheets.range and adding cells that are out of the range
 
Can I add several non sequential cells?

Currently I have

With Sheets("15min").Range("A2:S2")
.Parent.Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Resize(1,
18).Value = .Value ' copies data from row 1 down to the bottom

End With

But I also want to add some data to BA and CA of this same row. How can I do
that? When I try to add the data, it creates a new row...
BA = current time
CA = total sales (from Sales worksheet Cell C,5 )



Thanks
Phil





Bernie Deitrick[_2_]

sheets.range and adding cells that are out of the range
 
Phil,

Try:

Dim myRow As Long

With Sheets("15Min").Range("A2:S2")
myRow = .Parent.Range("A" & Rows.Count).End(xlUp)(2).Row
.Parent.Cells(myRow, 1).Resize(1, 18).Value = .Value
.Parent.Range("BA" & myRow).Value = "Whatever1"
.Parent.Range("CA" & myRow).Value = "Whatever2"
End With

HTH,
Bernie
MS Excel MVP

"Phillips" wrote in message
news:Ddgub.230946$Fm2.232118@attbi_s04...
Can I add several non sequential cells?

Currently I have

With Sheets("15min").Range("A2:S2")
.Parent.Range("A" & Rows.Count).End(xlUp).Offset(1,

0).Resize(1,
18).Value = .Value ' copies data from row 1 down to the bottom

End With

But I also want to add some data to BA and CA of this same row. How can I

do
that? When I try to add the data, it creates a new row...
BA = current time
CA = total sales (from Sales worksheet Cell C,5 )



Thanks
Phil








All times are GMT +1. The time now is 11:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com