Search : in
By :

Need some help whith vba

Last answer on Jul 21, 2009 6:22:46 am BST Da helpzor, on Jul 16, 2009 8:08:23 am BST 
 Report this message to moderators

Hello,
i have created a loop that loops thro column B and testing data up agenst seartan criterias, if they match it copys the data to a spesefied location. but i have one problem , what i am struggeling with is, When the loop has run through column B and chekd the data up agenst cell J9 and I10 i then want it to chek the data up against cell K9 and I11 and then L9 and I12 so on.

i have tryd wit offcet(0, k) and then make the k value incrise ewery time the loop has run through column B but im unble to increase the K value. :/

it is alo important to notice that the amount of data will newer be the same and it is imposible to know how many rows and column's i wil have.

im a beginner at Vba and im gratefulf for any help.

Best answers for « need some help whith vba » in :
Adding a VBA CommandButton with its respective the code Show Adding a VBA CommandButton with its respective the code Paste these two sub in a general module (Module1 for example). Sub CreateButton() Dim Obj As Object Dim Code As String Sheets("Sheet1").Select 'create button ...
[VBA] Detecting changes in cell Show [VBA] Detecting changes in cell The Event Change feature of a sheet will detects the change in the active cell but it gives no information about the content. The example given below will help you to find out if the cell was changed,...
VBA A simple second Timer Show VBA A simple second Timer In VBA, there is Timer feature available,but you can create one very easily. In a module sheet: Private Sub Worksheet_SelectionChange(ByVal Target As Range) 'For example: Start / Stop the timer every...
[VBA/VB6] My Documents + Environment Variables Show[VBA/VB6] My Documents + Environment Variables With VBA With VB6 Environment Functions Windows Variables Getting started As displayed in Windows Explorer, the My Documents folder appears to be in the root, but it is not the case. It...
[VB6/VBA] The CommonDialog control Show[VB6/VBA] The CommonDialog control The available functions with CommonDialog Getting started An example of a standard module The various functions of control CommonDialog Here is a list of all the available constants,although...
[VBA: VB6] Using excel from another application Show[VBA: VB6] Using excel from another application Here is a little routine to call Excel from VB6 or another Office application. Paste in a general module (eg Module1) In VBA>> Insert>> Module and paste in the window ... In VB6>>...
Download PDF SaM (Split and Merge) ShowPDFsam is a tool to merge and cut PDF files. It is an open source application to treat PDF files. It requires Virtual Java machine 1.4.2 or superior version. With a simple and intuitive interface, you can: - split documents PDF into chapters, into...
Download Data Fields Manager for Outlook ShowData Fields Manager for Outlook is a plugin for Microsoft Outlook. It add, search, replace, modify, rename, clean up the fields of the address book and to transform the characters into capital letters. Data Fields Manager for Outlook allows to add a...
Environment variables ShowEnvironment variables An environment variable is a dynamic value loaded into the memory that can be used by several processes operating simultaneously. On most operating systems, the location of some libraries or of the main system executables may...
Hyperlinks ShowIntroduction to anchors Hypertext links or hyperlinks (anchors) are HTML elements that, when clicked on, enable readers to visit a new address. Hyperlinked text is underlined by default. Hyperlinks are what connect web pages to one another. They...
Special characters ShowSpecial character codings HTML standards require all code to be written in 7-bit ASCII, which means that accented characters are not allowed. Despite this, current browsers recognise accented characters; you can enter accented characters directly...

1

Excelguru, on Jul 17, 2009 10:15:51 am BST

Hello Da helpzor

To get the no. of rows & columns use
activesheet.usedrange.rows.count
activesheet.usedrange.columns.count
Winners are losers who got up and gave it one more try. -Dennis DeYoung
My Interests are financial Modelling and custom excel development.

Reply to Excelguru

2

Da helpzor, on Jul 20, 2009 7:52:50 am BST

Hey there. i may be just me but i dont see wath you posted is gonna help me : /

here is the code i got so far (yeh it is at an exprimental stage and im a beginner so it may look loco) as i posted i want it to be able to not onlye teste the content of column B10 agenst J9 and I10 but i want it to be able to cahange the cells it test the content agenst.

hope it is possible to understant waht im trying to achive.


Sub Loop1()
Range("B10").Select
Dim k As Integer
k = 0


For x = 1 To 100 Step 1
If ActiveCell = Range("J9").Offset(0 & k) And ActiveCell.Offset(0, 2) = Range("I10").Offset(k & 0) And ActiveCell.Offset(0, 3).Value > Range("j10").Offset(0 & k).Value Then
ActiveCell.Offset(0, 3).Copy
Range("J10").PasteSpecial
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.Offset(1, 0).Select
End If

If IsEmpty(ActiveCell) Then
Range("B10").Select
End If
Next x


End Sub

Reply to Da helpzor

3

Excelguru, on Jul 21, 2009 4:28:08 am BST
  • +1

Hello Da helpzor

Instead of using Range("I10") use cells(9,y) where y=10,11,... and change all cell references to this structure and increase y=y+1 after 1 iteration until activesheet.usedrange.rows.count
Winners are losers who got up and gave it one more try. -Dennis DeYoung
My Interests are financial Modelling and custom excel development.

Reply to Excelguru

4

 Da helpzor, on Jul 21, 2009 6:22:46 am BST

Thanks a lot for the help i made it worke exactely the way i wanted ;)

Reply to Da helpzor