Lost Password?


Go Back   CodeCall Programming Forum > Software Development > Visual Basic Programming

Visual Basic Programming Discussion forum for Visual Basic, an event driven programming language and associated development environment from Microsoft for its COM programming model.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-24-2008, 03:40 AM
libran libran is offline
Newbie
 
Join Date: Jan 2008
Posts: 4
Rep Power: 0
libran is on a distinguished road
Default need help again!!

hi all,

I need to write a VBA code which will search data in 'Bold' from a list. It should be in dynamic array since the data will be updated constantly. I met many problem with this....attached is the data i need to work on...thanx a lot

Code:
Sub DynamicArray()

Dim Device() As String ' declares a dynamic array variable
Dim iCount As Integer
Dim Max As Integer
    Worksheets("Proto & Other Experiment").Activate
    ActiveSheet.Range("B2").EntireColumn.Select
'    Device = Selection.FindText(True, LookIn:=xlsPattern)
    Max = Worksheets("Proto & Other Experiment").Device.Count  ' finds the maximum array size
    ReDim Device(1 To Max) ' declares the array variable with the necessary size
    For iCount = 1 To Max
        Device(iCount) = Worksheets("Proto & Other Experiment").Device(iCount)
    Next iCount
    Erase Device() ' deletes the varible contents, free some memory
End Sub
Attached Files
File Type: doc help.doc (80.5 KB, 11 views)

Last edited by Jordan; 01-24-2008 at 08:41 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 01-24-2008, 08:44 AM
Jordan's Avatar   
Jordan Jordan is offline
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 9,203
Last Blog:
Ext JS or Ext GWT
Rep Power: 20
Jordan is just really niceJordan is just really niceJordan is just really niceJordan is just really nice
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default

Moved to correct forum. Added code tags.

Code:
 With currentFind.Font
            .Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red)
            .Bold = True
        End With
This was taken from
How to: Search for Text in Worksheet Ranges

And is an example of how to set a bold font. Just reverse it with an if statement to find bold selections.
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog
The CodeCall Wiki is now fully integrated with vBulletin users! Check it out and add some new pages!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-26-2008, 12:45 AM
libran libran is offline
Newbie
 
Join Date: Jan 2008
Posts: 4
Rep Power: 0
libran is on a distinguished road
Default

hey, thanx for the help...i hv write out the code as below...but keep having error in this line [For arr = 0 To Device(arrAddr).Size]

Ani cant figure out the error...pls help me on tt..thanx
Code:
Sub DynamicArray()

Dim Device() As String    ' declares a dynamic array variable
Dim iCount As Integer
Dim Max As Integer

Max = 0
   Worksheets("Proto & Other Experiment").Activate
   ActiveSheet.Range("B2").EntireColumn.Select


   For row = 2 To 200
    If Cells(row, 2).Font.Bold = True Then
    Max = Max + 1
    End If
   Next row
   
   ReDim Device(Max)
   arrAddr = 0
   
   For row = 2 To 200
    If Cells(row, 2).Font.Bold = True Then
    Device(arrAddr) = Cells(row, 2).Value
    arrAddr = arrAddr + 1
    End If
   Next row


   For arr = 0 To Device(arrAddr).Size 'Size of the array
   ODBCConn (Device(arrAddr))
   Next arr
  End Sub

Last edited by TcM; 01-26-2008 at 04:57 AM. Reason: USE THE CODE TAGS!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
Forum Jump


All times are GMT -5. The time now is 06:38 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 97%

Ads