Set Data From Each (preselected) Rows in String and Paste [Loop]

sartou

New Member
Joined
Dec 21, 2020
Messages
4
Platform
  1. Windows
Hello all,

I'm a beginner with VBA and I did all my code with some example on forum.

I have some "Data Table" and I would like to fill an Intranet Web Form faster than I used to.
I did an Excel Form which is used to log on the intranet and Navigate to the correct Web Form.
But after that I would like to fill the Form with my table's datas.
I've select the Range with

VBA Code:
Sub GetRange()
    Dim ACell As String
    Dim BCell As String
'(etc)
    Dim rng1 As Range
    Dim rng2 As Range
    Dim rng3 As Range
    Set rng1 = Cells.Find("*", [a1], xlFormulas, , xlByRows, xlPrevious)
    Set rng2 = Cells.Find("*", [a1], xlFormulas, , xlByColumns, xlPrevious)
    If Not rng1 Is Nothing Then
        Set rng3 = Range([a16], Cells(rng1.Row, rng2.Column))
        Application.Goto rng3
    End If
End Sub

Now, what I need and what I'm struggling with :
In this select Range, I would like to put :

ACell = value of cell in column A in the first row, BCell = value of cell in column B, etc
And then past it in my webform with: idoc.all.P2300.Value = ACell, idoc.all.P2400.Value = BCell
And then restart with the next row until the last selected row.

(Hope my English is fine, it's not my mothertongue)

Thanks in advance for your help.
 

Some videos you may like

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

sartou

New Member
Joined
Dec 21, 2020
Messages
4
Platform
  1. Windows
I don't know if it can help but I've already name each column with this :
(First I've erased all the possible already here name)

VBA Code:
    Dim NoName As Name                                                                                             
    For Each NoName In ActiveWorkbook.Sheets("Liste candidats").Names
        NoName.delete
    Next NoName

And after that, I did the following code for each column in my vba code

VBA Code:
    Range("B15").Select
    Range("B15:B25").Select
    Range("B25").Activate
    Application.CutCopyMode = False
    ActiveWorkbook.Names.Add Name:=Range("B15").Value, RefersToR1C1:= _
        "='Liste candidats'!R15C2:R25C2"
 

sartou

New Member
Joined
Dec 21, 2020
Messages
4
Platform
  1. Windows
to explain a little better what I can't do:

Maybe I can do something like this :

VBA Code:
For Each row in Myrange.row
   For Each cell in row.cell
          If Columm.cell=FirstName Then
                    FNameCell =  Cell.Value
                    idoc.all.P2300.Value = FNameCell
          End IF
   Next Cell
   
   For Each cell in row.cell
          If Columm.cell=LastName Then
                    LNameCell =  Cell.Value
                    idoc.all.P2300.Value = LNameCell
          End IF
   Next Cell
   
   

Next row

But I don't know how to code this...
 

sartou

New Member
Joined
Dec 21, 2020
Messages
4
Platform
  1. Windows
Find a solution by create a real table... in fact that was pretty simple
 

Watch MrExcel Video

Forum statistics

Threads
1,127,222
Messages
5,623,470
Members
415,973
Latest member
johnemaile

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top