Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
reading database and filling excel
Hi,
I'm trying to read from SQL server and create a Excel report from it. I can do this by exporting data function. However I need to place up to 3 clip arts in the first column on this report based on the condition in the another cells and also change the background color for the entire row. I can insert the image, but I have problem with resizing the cell based on the images and also checking to see if the ccell already have the image then do not insert again. Here is my code I used so far: Sub Macro1() ' Dim TotalRows As Integer TotalRows = ActiveSheet.UsedRange.Rows.Count For i = 1 To TotalRows If Range("C" & (i + 4)) = "Y" Then ActiveSheet.Shapes("Picture 1").Select Selection.Copy Range("A" & (i + 4)).Select ActiveSheet.Paste ' Selection.Rows.AutoFit ' Selection.Columns.AutoFit For Each sht In ActiveWorkbook.Worksheets sht.Columns("A:A").EntireColumn.AutoFit Next sht End If Next I would appreciate your feed back on this issue. Regards, Bob End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Update Excel Database via Access Main Database with a script | New Users to Excel | |||
reading database value into a cell | Excel Programming | |||
Filling Database Query | Excel Programming | |||
Reading data from a database | Excel Programming | |||
Reading with ADO from Access database over network | Excel Programming |