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 select cells? 1

Status
Not open for further replies.

garrbel

Technical User
Sep 22, 2010
14
PT
Hi

We can select cells. I do like this:
Cells(i, 2).Select
Selection.Copy

Can I select cells (i,2) (i,3) (i,5) in one statement?(non adjacent cells)

cells (i,2) (i,3) (i,5). select
Selection.copy

thanks
 



There probably is a muc better way.

Please post some sample data that illustrates your process.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Ok - I do this for several colluns

i = 8
While Cells(i, 1) <> ""
i = i + 1
Wend
i = i - 1

Cells(i, 2).Select
Rows(i).Select
Selection.Insert Shift:=xlDown

'for cells with operations
Cells(i - 1, 1).Select
Selection.Copy
Range(Cells(i, 1), Cells(i + 1, 1)).Select
ActiveSheet.Paste

'for cells without operations
Cells(i + 1, 2).Select
Selection.Copy
Cells(i, 2).Select
ActiveSheet.Paste
Cells(i + 1, 2).Select
Selection.ClearContents

That's the way I found and it's work.

Something like this:

5|2|=5*2|3|1|=3*1|
 



Dont give me code that tells me HOW you THINK it should be done.

Tell me functionally WHAT needs to happen.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
I use a worksheet whith 30 columns to have control over water bill. (the same for electricity bill)
And I'll do it one time a month.
For each time I want to have formulas ready in last row. I mean for this month I click a button and I'll have the row ready to work. Lets say column C with =B-A column E with =B*D
Also in rows 1,2,3,4,5 I have totals and averages update all time.
I hope this is clear to you

 

For each time I want to have formulas ready in last row.
If you would use the List or Table feature of Excel, this would be a given! NO VBA REQUIRED!!!

For instance, I have a table using formulas in several non-adjacent cells. I desined this as a Table (2007) or a List (2003 & earlier). When I TAB into the new row, my formulas appear after I enter data in the first required cell of the row.

NO VBA, no copy 'n' paste!!! Native Excel feature!

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