VBA code to check formatted cell value

Mose

New Member
Joined
May 8, 2020
Messages
3
Office Version
  1. 2016
Hi,

I need to check for the data in a cell and paste it in a cell in another sheet of same workbook. Sometimes due to other conditions the data will be invisible in the cell(only visible in the formula bar). Can you please help with an VBA code to check, copy data and paste only if the data is visible in the cell.

I tried with the below query, but it is not working as expected, always returns the value eventhough if it is invisible in the cell.

If Worksheets("Sheet1").Range("A10").FormatConditions.Count > 0 Then
MsgBox "Cell is formatted"
Worksheets("Sheet1").Range("A10").Copy
Worksheets("Sheet2").Range("A5").PasteSpecial Paste:=xlPasteValues
End If
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Data will be visible in the cell depending on the data on another cell(A15). That cell has dynamic value. For some case, if the value is greater than 200, then the data on the cell A10(Sheet1) will be visible, if data is less than 200, then data on the cell A10(Sheet1) is made invisible( only displayed in the formula bar). This logic was created by someother person, so now sure what rule or conditions he used. Now, I am writing VBA code to check and copy required data to another sheet.
 
Upvote 0
I am not sure what condition has been set for this cell and even the other cell(A15) is dynamic. Sometimes if Data is 1 on A1 and Value is >200 on A15, text in the cell A10 is getting displayed. In another scenario if Data is 2 on A1 and Value is > 300 on A15, thn only text in the cell A10 is getting displayed.
So instead of using A15 cell condition, thought it will be good, if it is possible to copy text from cell A10 if is visible in clear eyes.
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,928
Members
449,094
Latest member
teemeren

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