Copy Formula to Active Rows Only

DC0429

New Member
Joined
Jan 27, 2010
Messages
28
Office Version
  1. 2019
Platform
  1. Windows
Need help with the following please... Looking for a way to have a pre-determined formula populate cells in Column K if cells in Column A have data. So, if A2 has data, I need a formula in K2. Formula for K3 if A3 has data (same formula) and so on. I would prefer not to use a typical formula such as "=IF(A2<>"",X,Y)" since this has the potential to cover 1000+ rows. Additionally, we will be deleting rows as they become old and/or obsolete. Any help would be greatly appreciated.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Try:

This will get you up to 5000 Lines

Code:
Sub Formula()
Dim Formula As String
Dim Mycell As Range
Dim EOS As Long

EOS = Worksheets("Sheet1").Range("A5000").End(xlUp).Row

Formula = Enter your Formula Here"

For Each Mycell In Worksheets("Sheet1").Range("A2:A" & EOS)
    If Mycell.Value <> "" Then
        Mycell(1, 11).Value = Formula
    End If
Next Mycell
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,429
Messages
6,119,433
Members
448,897
Latest member
ksjohnson1970

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
Back
Top