Home Excel VBA code for simple formula between cells
Reply: 0

Excel VBA code for simple formula between cells

user7223
1#
user7223 Published in September 19, 2018, 6:43 pm

I need a code for these orders:

  1. Go to first blanks cell in column C.
  2. Calculat the number in column D minus 14 and do it as long there is a number right to the cell in D (there is blanks in column D)
  3. Copy the result in column C and paste it as values to Column B. note: I need it to stay in original rows.

` OP_wb.Sheets("Optic Main").Activate Dim FirstRow As Range Dim LastRow As Range Set FirstRow = Range("C1").End(xlDown).Offset(1, 0)

Range("E1").End(xlDown).Offset(0, -2).Select
Range(FirstRow, LastRow).FormulaR1C1 = "=(c4-14)"`
share|improve this question
  • @TimWilkinson that is what I have: OP_wb.Sheets("Optic Main").Activate Range("C1").End(xlDown).Offset(1, 0).Activate ActiveCell.FormulaR1C1 = "=RC[1]-14" – Rafael Osipov Jul 26 '17 at 11:06
  • here is where i stuck now: Dim FirstRow As Range Dim LastRow As Range Set FirstRow = Range("C1").End(xlDown).Offset(1, 0) Set LastRow = Range("E1").End(xlDown).Offset(0, -2) Range(FirstRow, LastRow).FormulaR1C1 = "=(RC4-14)" – Rafael Osipov Jul 26 '17 at 12:51

1 Answer 1

active oldest votes
up vote 0 down vote accepted
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.356185 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO