Copyfromrecordset numeric null values problem in excel

Rita777

New Member
Joined
Nov 23, 2011
Messages
19
Hello,
When using copyfromrecordset to paste a DAO recordset into excel, how do null values- both string and numeric- get pasted? Are they pasted as blanks, empty, or as 0-length strings?

What I need to do is shade a particular row in if the pasted value is blank (so in the original query, the value was Null). So I tried to check if the cell is blank and then shade as follows:

PHP:
If wb.sheets(currentsubtask).range(TOTALScol & header_OTPS + i).Value = Empty Then
      'I also tried = blank, and = " " in the If statement above
 With wb.sheets(currentsubtask).range(TOTALScol & header_OTPS + i).Interior
        .ColorIndex = 2
        .Pattern = xlGray16
        .PatternColorIndex = xlAutomatic
    End With
End If

This doesn't work- the rows where the totals are blank aren't being shaded. What are numeric Nulls pasted as?
Thank you in advance for your suggestions!
 
Last edited:

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Forum statistics

Threads
1,223,911
Messages
6,175,334
Members
452,636
Latest member
laura12345

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