mismatch error when populate date in adjacent cell based on word in another

leap out

Active Member
Joined
Dec 4, 2020
Messages
271
Office Version
  1. 2016
  2. 2010
Hello
I search for way to fix mismatch error in this line
VBA Code:
If Range("E2:E" & I).Value = "PAID"
after populate date in adjacent cells in column F if the cells in column E contain "PAID" will show the error !
I use this
VBA Code:
Dim I As Long, LR As Long
For I = 2 To LR
If Range("B2:B" & I).Interior.ColorIndex = xlNone Then Range("E2:E" & I) = "PAID"
If Range("E2:E" & I).Value = "PAID" Then Range("F2:F" & I) = Date
Next I
but I'm not sure where is my bad !
 
based on your pictures 1,2 .
does populate dates in adjacent cells"PAID" for column F ?
 
Upvote 0

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Column F is updated to PAID based on column B interior colorindex
If Range("B2:B" & I).Interior.ColorIndex = xlNone Then Range("E2:E" & I) = "PAID"

If you put in a range of cells ie B2:B4 then unless all the cells are the same interior colorindex it turns a value of Null (=xlNone)
 
Upvote 0
now I understood and noted that based on specifying the range as you did it :cautious:, but if make it dynamically B2:B & LR doesn't seem to be problem , right?.
 
Upvote 0
For what you are doing just stick with using just 1 Cell in your If statements eg Range("E" & I) where I is your counter variable.
 
Upvote 0

Forum statistics

Threads
1,215,339
Messages
6,124,362
Members
449,155
Latest member
ravioli44

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