GeorgeTimes
New Member
- Joined
- Jul 22, 2022
- Messages
- 16
- Office Version
- 365
- 2021
- 2019
- 2016
- 2013
- 2011
- 2010
- 2007
- Platform
- Windows
Hi all,
I need your help for a VBA code that does the next:
Find first blank cell in column A (I have this) : Range("A" & Rows.Count).End(xlUp).Offset(1).Select
Once you found the last column from A, I need to populate this formula till last row based on column G : =G4. So I will have:
A10 has value =G10
A13 has value =G13 and so on...
My issue is:
1 - If last row in G column is 50, and the first empty row in column A is 40, then I need a code to paste the formula to A40 - A50. I'm not sure how to write that code in order to paste within this range (the range will be different every time I run the code)
2 - how can I modify the formula from =G4 to =G40, =G41 etc. if I don't know what row will be the last one when I run the macro. The number of row needs to be the same in column A and column G. Again, I'm not sure how I can change the number from the formula as next time I run the code I can start from row 70 for example
I've attached an example of this. A2 and A3 already have the formula, G6 is the last row so I need a vba to fill in from A4 till A6 the next:
A4: =G4
A5: =G5
A6: =G6
I need your help for a VBA code that does the next:
Find first blank cell in column A (I have this) : Range("A" & Rows.Count).End(xlUp).Offset(1).Select
Once you found the last column from A, I need to populate this formula till last row based on column G : =G4. So I will have:
A10 has value =G10
A13 has value =G13 and so on...
My issue is:
1 - If last row in G column is 50, and the first empty row in column A is 40, then I need a code to paste the formula to A40 - A50. I'm not sure how to write that code in order to paste within this range (the range will be different every time I run the code)
2 - how can I modify the formula from =G4 to =G40, =G41 etc. if I don't know what row will be the last one when I run the macro. The number of row needs to be the same in column A and column G. Again, I'm not sure how I can change the number from the formula as next time I run the code I can start from row 70 for example
I've attached an example of this. A2 and A3 already have the formula, G6 is the last row so I need a vba to fill in from A4 till A6 the next:
A4: =G4
A5: =G5
A6: =G6