• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 287
  • Last Modified:

get cell next to last cell in an adjacent column

Hello. Can someone give me a macro to start in a cell of a column and then go to the top of that column and fill in the formula
=IF(A2=A1,A2,A2-1)
in each cell of that column but stopping after row number of the last cell which contains data in the previous column?

Thanks!
0
willie108
Asked:
willie108
1 Solution
 
NorieCommented:
Not sure which columns you want to use but try this.
LastRow = Range("A" & Rows.Count).End(xlUp).Row

Range("B1").Resize(LastRow).Formula = "=IF(A2=A1, A2, A2-1)"

Open in new window

0
 
willie108Author Commented:
Thanks!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now