+ Reply to Thread
Results 1 to 2 of 2

Insert cell value from column row text with userform

  1. #1
    Registered User
    Join Date
    03-24-2015
    Location
    Sao Paulo, Brazil
    MS-Off Ver
    2013
    Posts
    0

    Insert cell value from column row text with userform

    Hello,

    I am trying to use a userform to automatically insert price quote for different products of different suppliers in sheet 2 (quotation) - for various products and suppliers...
    quota.jpg

    I also have a label that looks up the previous value for that cell reference so I can check what was the value before the price update... So far I found the following code that suits well for my needs to only insert the new price but not automatic... I though the userform was the right way to go but just cant figure it out how to do it... Any help would be greatly appreciated - Thanks!

    Cell A1 - Blank

    A2:A - product list
    B1:XDO1 - supplier list

    Public Sub FindWithArray()
    Dim rng As Range

    ' To store the targe fornecedor index
    Dim colArray(10) As Integer

    ' To store the targe insumo index
    Dim rowArray(10) As Integer

    ' Store the First value for Find & FindNext
    Dim firstAddress As String

    Dim i As Integer
    Dim j As Integer
    i = 0
    j = 0
    Sheet2.Activate
    With Range("B1:xd1")
    Set rng = .Find("alfamec", LookIn:=xlValues)
    If Not rng Is Nothing Then
    firstAddress = rng.Address

    Do
    Set rng = .FindNext(rng)
    colArray(i) = rng.Column
    i = i + 1

    Loop While Not rng Is Nothing And rng.Address <> firstAddress
    End If
    End With

    With Range("A2:A2000")
    Set rng = .Find("abacaxi", LookIn:=xlValues)
    If Not rng Is Nothing Then
    firstAddress = rng.Address

    Do
    Set rng = .FindNext(rng)
    rowArray(j) = rng.Row
    j = j + 1

    Loop While Not rng Is Nothing And rng.Address <> firstAddress
    End If
    End With

    Dim c As Integer
    Dim r As Integer

    For c = 0 To i - 1
    For r = 0 To j - 1
    Cells(rowArray(r), colArray(c)).Value = "R$7"
    Next r
    Next c

    End Sub

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166
    Hello Gabriel Ribeiro,

    Welcome to Excelforum. Be a part of large Excel community. Enjoy Learning.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Insert blank row after each cell that contains text in column A
    By anrichards22 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-14-2013, 03:10 AM
  2. How to insert text under the last used cell of a column using vba
    By skavety in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 03-10-2013, 09:58 PM
  3. Insert row with certain text based on value in a cell in Column A
    By bholabhala in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-16-2011, 05:06 AM
  4. how to insert a column if text is added to a cell
    By ahs004 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-16-2011, 04:35 AM
  5. how to - Insert predifined text in each cell of a column
    By npereira in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-18-2005, 04:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1