Advice for a novice

Paddy1979

Well-known Member
Joined
Sep 23, 2005
Messages
608
Hello i have just written the below code, and i was wondering is there a quicker/easier way to write the same code ?

Worksheets("Summary").Activate
With ActiveSheet

.Range("F98").Value = "=SUMIF(R2C4:R96C4,""D"",R2C:R96C)"
.Range("G98").Value = "=SUMIF(R2C4:R96C4,""D"",R2C:R96C)"
.Range("H98").Value = "=SUMIF(R2C4:R96C4,""D"",R2C:R96C)"
.Range("I98").Value = "=SUMIF(R2C4:R96C4,""D"",R2C:R96C)"
.Range("J98").Value = "=SUMIF(R2C4:R96C4,""D"",R2C:R96C)"
.Range("K98").Value = "=SUMIF(R2C4:R96C4,""D"",R2C:R96C)"
.Range("N98").Value = "=SUMIF(R2C4:R96C4,""D"",R2C:R96C)"
.Range("O98").Value = "=SUMIF(R2C4:R96C4,""D"",R2C:R96C)"
.Range("P98").Value = "=SUMIF(R2C4:R96C4,""D"",R2C:R96C)"
.Range("Q98").Value = "=SUMIF(R2C4:R96C4,""D"",R2C:R96C)"
.Range("L98").Value = "=IF(RC[-6]<1,0,RC[-6]/RC[-1])"
.Range("M98").Value = "=IF(RC[-7]<1,0,RC[-7]/(RC[-2]-RC[-3]))"

cheers
patrick
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

onlyadrafter

Well-known Member
Joined
Aug 19, 2003
Messages
5,703
Platform
  1. Windows
Hello,

How about

Code:
Worksheets("Summary").Activate
With ActiveSheet
.Range("F98:Q98").Value = "=SUMIF(R2C4:R96C4,""D"",R2C:R96C)"
.Range("L98").Value = "=IF(RC[-6]<1,0,RC[-6]/RC[-1])"
.Range("M98").Value = "=IF(RC[-7]<1,0,RC[-7]/(RC[-2]-RC[-3]))"
End With
 

Forum statistics

Threads
1,175,985
Messages
5,900,734
Members
434,848
Latest member
kubersood321

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top