Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Cell coloring giving me fits

Hello,

I am programatically brining in data to a range of cells in a worksheet. The
way I am doing this is connecting to SQL Server and assigning the results to
a range of cells.

The problem I have is that when the data is placed into the worksheet, it
highlights all of the cells blue. I cannot figure out what is going this. I
don't want it to change colors, or anything like that. I just want the data
placed in the worksheet.

Any ideas as to what is happening? The code which retrieves the data is below.

Thank you in advance

Dim sda As New SqlDataAdapter(cmd)
lagData = New DataSet
sda.Fill(lagData)

Dim dt As DataTable = lagData.Tables(0)
rowCount = dt.Rows.Count + 6

Dim strRange As String = "D6"

rngList = DirectCast(lagDataWS.Range(strRange), Excel.Range)
rngList = rngList.Resize(dt.Rows.Count + 1, dt.Columns.Count)
rngList.Value2 = Me.ConvertDataTableToArray(dt)

Dim lo As Excel.ListObject
lo = lagDataWS.ListObjects.AddEx(Excel.XlListObjectSour ceType.xlSrcRange,
rngList, , Excel.XlYesNoGuess.xlYes)
lo.Name = "blah"

rngList.Columns.AutoFit()

lagDataWS.Activate()

--
Thanks,

Scott
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Cell coloring giving me fits

one thing i think of is - does that range of cells have any
conditional formatting applied to it?
:)
susan


On Nov 20, 1:39*pm, SQLScott
wrote:
Hello,

I am programatically brining in data to a range of cells in a worksheet. The
way I am doing this is connecting to SQL Server and assigning the results to
a range of cells.

The problem I have is that when the data is placed into the worksheet, it
highlights all of the cells blue. I cannot figure out what is going this. I
don't want it to change colors, or anything like that. I just want the data
placed in the worksheet.

Any ideas as to what is happening? The code which retrieves the data is below.

Thank you in advance

Dim sda As New SqlDataAdapter(cmd)
lagData = New DataSet
sda.Fill(lagData)

Dim dt As DataTable = lagData.Tables(0)
rowCount = dt.Rows.Count + 6

Dim strRange As String = "D6"

rngList = DirectCast(lagDataWS.Range(strRange), Excel.Range)
rngList = rngList.Resize(dt.Rows.Count + 1, dt.Columns.Count)
rngList.Value2 = Me.ConvertDataTableToArray(dt)

Dim lo As Excel.ListObject
lo = lagDataWS.ListObjects.AddEx(Excel.XlListObjectSour ceType.xlSrcRange,
rngList, , Excel.XlYesNoGuess.xlYes)
lo.Name = "blah"

rngList.Columns.AutoFit()

lagDataWS.Activate()

--
Thanks,

Scott


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Cell coloring giving me fits

nope, it is straight data...

--
Thanks,

Scott


"Susan" wrote:

one thing i think of is - does that range of cells have any
conditional formatting applied to it?
:)
susan


On Nov 20, 1:39 pm, SQLScott
wrote:
Hello,

I am programatically brining in data to a range of cells in a worksheet. The
way I am doing this is connecting to SQL Server and assigning the results to
a range of cells.

The problem I have is that when the data is placed into the worksheet, it
highlights all of the cells blue. I cannot figure out what is going this. I
don't want it to change colors, or anything like that. I just want the data
placed in the worksheet.

Any ideas as to what is happening? The code which retrieves the data is below.

Thank you in advance

Dim sda As New SqlDataAdapter(cmd)
lagData = New DataSet
sda.Fill(lagData)

Dim dt As DataTable = lagData.Tables(0)
rowCount = dt.Rows.Count + 6

Dim strRange As String = "D6"

rngList = DirectCast(lagDataWS.Range(strRange), Excel.Range)
rngList = rngList.Resize(dt.Rows.Count + 1, dt.Columns.Count)
rngList.Value2 = Me.ConvertDataTableToArray(dt)

Dim lo As Excel.ListObject
lo = lagDataWS.ListObjects.AddEx(Excel.XlListObjectSour ceType.xlSrcRange,
rngList, , Excel.XlYesNoGuess.xlYes)
lo.Name = "blah"

rngList.Columns.AutoFit()

lagDataWS.Activate()

--
Thanks,

Scott



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Cell coloring giving me fits

Just to be sure, run this little macro and see if the message box gives you a
count greater than zero.

Sub quickCheck()
Dim c As Range
For Each c In Sheets(1).UsedRange
If c.FormatConditions.Count 0 Then
x = x + 1
End If
Next
MsgBox x
End Sub

If it does, your sheet contains conditional foramatting.


"SQLScott" wrote:

nope, it is straight data...

--
Thanks,

Scott


"Susan" wrote:

one thing i think of is - does that range of cells have any
conditional formatting applied to it?
:)
susan


On Nov 20, 1:39 pm, SQLScott
wrote:
Hello,

I am programatically brining in data to a range of cells in a worksheet. The
way I am doing this is connecting to SQL Server and assigning the results to
a range of cells.

The problem I have is that when the data is placed into the worksheet, it
highlights all of the cells blue. I cannot figure out what is going this. I
don't want it to change colors, or anything like that. I just want the data
placed in the worksheet.

Any ideas as to what is happening? The code which retrieves the data is below.

Thank you in advance

Dim sda As New SqlDataAdapter(cmd)
lagData = New DataSet
sda.Fill(lagData)

Dim dt As DataTable = lagData.Tables(0)
rowCount = dt.Rows.Count + 6

Dim strRange As String = "D6"

rngList = DirectCast(lagDataWS.Range(strRange), Excel.Range)
rngList = rngList.Resize(dt.Rows.Count + 1, dt.Columns.Count)
rngList.Value2 = Me.ConvertDataTableToArray(dt)

Dim lo As Excel.ListObject
lo = lagDataWS.ListObjects.AddEx(Excel.XlListObjectSour ceType.xlSrcRange,
rngList, , Excel.XlYesNoGuess.xlYes)
lo.Name = "blah"

rngList.Columns.AutoFit()

lagDataWS.Activate()

--
Thanks,

Scott



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cell Coloring MrMarbles Excel Discussion (Misc queries) 2 January 13th 10 02:53 PM
Cell coloring Peter Excel Discussion (Misc queries) 3 February 8th 09 11:15 PM
Cell Coloring supersub15 Excel Worksheet Functions 2 October 26th 07 04:12 PM
Excel to Outlook VBA giving my Calendar Fits [email protected] Excel Programming 2 February 7th 06 07:37 PM
Detecting if a value "fits" in a cell. Robert Mulroney[_3_] Excel Programming 10 November 15th 05 10:20 PM


All times are GMT +1. The time now is 08:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"