# Selection of Cells

#### bschulze

##### Active Member
I am creating a macro to do some calculations on one of my sheets. I want to write the macro to insert these calculations however do not want the macro to select the cell...just for simplification purposes. my code is:

Range("B3").Select
ActiveCell.FormulaR1C1 = "=IF(SUM(AL!C)<>0,SUM(AL!C),""No Data Found"")"

I want to get rid of the "Range("B3").Select"

Any help would be greatly appreciated.

### Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

#### kjo1080

##### Active Member
ok, so delete Range("B3").Select from your code

#### bschulze

##### Active Member
there are about 50 formulas in this macro. How would it know what cell to insert the formula in?

#### kjo1080

##### Active Member
you would have to tell it by leaving Range("B3").Select and changing that cell for each formula.

We are going in circles here. Maybe I don't understand what you are trying to do.

#### bschulze

##### Active Member

Sorry I am not being more specific. The code is very busy and I was trying to simplify it. Here is an example:

Range("B4").Select
ActiveCell.FormulaR1C1 = "=IF(SUM(AK!C)<>0,SUM(AK!C),""No Data Found"")"
Range("B5").Select
ActiveCell.FormulaR1C1 = "=IF(SUM(AZ!C)<>0,SUM(AZ!C),""No Data Found"")"
Range("B6").Select
ActiveCell.FormulaR1C1 = "=IF(SUM(AR!C)<>0,SUM(AR!C),""No Data Found"")"
Range("B7").Select
ActiveCell.FormulaR1C1 = "=IF(SUM(CA!C)<>0,SUM(CA!C),""No Data Found"")"
Range("B8").Select
ActiveCell.FormulaR1C1 = "=IF(SUM(CO!C)<>0,SUM(CO!C),""No Data Found"")"
Range("B9").Select
ActiveCell.FormulaR1C1 = "=IF(SUM(CT!C)<>0,SUM(CT!C),""No Data Found"")"
Range("B10").Select
ActiveCell.FormulaR1C1 = "=IF(SUM(AL!C)<>0,SUM(AL!C),""No Data Found"")"

I am trying to get it to look like:

Range("B9").select = "=IF(SUM(AL!C)<>0,SUM(AL!C),""No Data Found"")"
Range("B9").select = "=IF(SUM(AL!C)<>0,SUM(AL!C),""No Data Found"")"
Range("B9").select = "=IF(SUM(AL!C)<>0,SUM(AL!C),""No Data Found"")"
Range("B9").select = "=IF(SUM(AL!C)<>0,SUM(AL!C),""No Data Found"")"
Range("B9").select = "=IF(SUM(AL!C)<>0,SUM(AL!C),""No Data Found"")"
Range("B9").select = "=IF(SUM(AL!C)<>0,SUM(AL!C),""No Data Found"")"
Range("B9").select = "=IF(SUM(AL!C)<>0,SUM(AL!C),""No Data Found"")"

#### just_jon

##### Legend
Change these

Range("B4").Select
ActiveCell.FormulaR1C1 = "=IF(SUM(AK!C)<>0,SUM(AK!C),""No Data Found"")"

to these

Range("B4").FormulaR1C1 = "=IF(SUM(AK!C)<>0,SUM(AK!C),""No Data Found"")"

No need for Selects.

#### bschulze

##### Active Member
Thanks for the tip

Replies
4
Views
160
Replies
1
Views
99
Replies
2
Views
139
Replies
1
Views
171
Replies
1
Views
113