VBA issue: strFormulas returning 1004 error

jaspalsd

Board Regular
Joined
Feb 3, 2014
Messages
72
Hi,

I've applied similar logic to two other macros but for some reason I am unable to figure out what I'm doing wrong :crash:

Code:
Sub sfortest()Sheets("Cleanup").Select
Range("M2").Select




   
    Dim Lastrow As Long
    Lastrow = Range("L" & Rows.Count).End(xlUp).Row


    Dim strFormulas(1 To 2) As Variant


    With Sheets("Cleanup")
        strFormulas(1) = "=IFERROR(VLOOKUP(G2,'HCBF RV Portfolio'!G:Q,9,0),"")"
        strFormulas(2) = "=IFERROR(VLOOKUP(G2,'HCBF RV Portfolio'!G:Q,11,0),"")"
   'issue on this line' .Range("M2:N2").Formula = strFormulas
        .Range("M2:N" & Lastrow).FillDown
        
        
        End With
        
    
    
   
    End Sub

I am probably doing some very stupid!

I will appreciate any help,

Thanks!
 
Last edited:

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Try
Code:
   With Sheets("Cleanup")
      strFormulas(1) = "=IFERROR(VLOOKUP(G2,'HCBF RV Portfolio'!G:Q,9,0),[COLOR=#ff0000]""""[/COLOR])"
      strFormulas(2) = "=IFERROR(VLOOKUP(G2,'HCBF RV Portfolio'!G:Q,11,0),[COLOR=#ff0000]""""[/COLOR])"
      .Range("M2:N" & Lastrow).Formula = strFormulas
   End With
 
Upvote 0
Thanks, the double quotations did me....

I'm looking to apply alternate row shading to this range and I've come across a few methods but I'm wondering if it's possible to create strFormulas(3) and apply the formula of MOD(ROW(),2) and relate it a particular shade?

The range is within the formula above e.g. M2:N & LastRow

Thanks again for your help Fluff!
 
Upvote 0
A formula cannot change the format, unless you put in in Conditional Formatting
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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