PC Review


Reply
Thread Tools Rate Thread

Cell coloring giving me fits

 
 
SQLScott
Guest
Posts: n/a
 
      20th Nov 2008
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.XlListObjectSourceType.xlSrcRange,
rngList, , Excel.XlYesNoGuess.xlYes)
lo.Name = "blah"

rngList.Columns.AutoFit()

lagDataWS.Activate()

--
Thanks,

Scott
 
Reply With Quote
 
 
 
 
Susan
Guest
Posts: n/a
 
      20th Nov 2008
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 <SQLSc...@discussions.microsoft.com>
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 resultsto
> 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.XlListObjectSourceType.xlSrcRange,
> rngList, , Excel.XlYesNoGuess.xlYes)
> lo.Name = "blah"
>
> rngList.Columns.AutoFit()
>
> lagDataWS.Activate()
>
> --
> Thanks,
>
> Scott


 
Reply With Quote
 
SQLScott
Guest
Posts: n/a
 
      20th Nov 2008
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 <SQLSc...@discussions.microsoft.com>
> 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.XlListObjectSourceType.xlSrcRange,
> > rngList, , Excel.XlYesNoGuess.xlYes)
> > lo.Name = "blah"
> >
> > rngList.Columns.AutoFit()
> >
> > lagDataWS.Activate()
> >
> > --
> > Thanks,
> >
> > Scott

>
>

 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      20th Nov 2008
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 <SQLSc...@discussions.microsoft.com>
> > 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.XlListObjectSourceType.xlSrcRange,
> > > rngList, , Excel.XlYesNoGuess.xlYes)
> > > lo.Name = "blah"
> > >
> > > rngList.Columns.AutoFit()
> > >
> > > lagDataWS.Activate()
> > >
> > > --
> > > Thanks,
> > >
> > > Scott

> >
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Persistent Toolbars giving me fits Steve Rau Microsoft Word Document Management 3 23rd May 2009 07:54 AM
Excel Docs giving me fits km1976 Microsoft Word New Users 2 31st Jan 2009 10:25 PM
Tweakui giving me fits. =?Utf-8?B?R2FycmV0dA==?= Windows XP General 3 5th Mar 2006 04:18 PM
Word merge is giving me fits... =?Utf-8?B?UmF2ZW4=?= Microsoft Word Document Management 1 3rd Mar 2005 10:14 AM
Logon as administrator is giving me fits!!! HELP! HopŠ Windows XP Networking 1 1st Oct 2003 10:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:06 PM.