Topic: "Any excel wizards here ?" (page 1 of 1)

1
Author Post
sniperkid
groupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
Im sure its quite possible to do but it seems quite impossible for me :P

This is basically what i was looking for;

1. A macro button that asks for a number (when clicked).
2. It searches a row (just 1 row) for the string.
3. It then checks the column of that row to see how many blank values are in it ( = 0 in a specified area).
4. It prints out values in the row (specified).

Any help or bits of code that would help me achieve this would be very much appreciated.
private message Website
Inferno
groupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
Like always, google knows.....
private message
unknown user
just quickly write it in vba.
EMail
sniperkid
groupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
hands up those who know vba :no:.
private message Website
bb
groupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
http://spreadsheets.about.com/cs/exceladvanced/a/vba1index.htm looks like a good place to start.

Else try http://www.google.co.uk/search?q=vba+for+beginners

bb
private message Website
sniperkid
groupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
ok after a bit of research i have found the following code which almost does exactly what i want.

    Sheets("Sheet1").Select
    ' Find the last row of data
    FinalRow = Range("A65536").End(xlUp).Row
    ' Loop through each row
    For x = 3 To FinalRow
        ThisValue = Range(col & x).Value
        'Range("") = column to look in
        
        If ThisValue = 0 Then
            Range("B" & x & ":F" & x).Copy
            Sheets("test").Select
            Nextrow = Range("A65536").End(xlUp).Row + 1
            Range("A" & Nextrow).Select
            ActiveSheet.Paste
            Range("F" & Nextrow).Value = strweek
            Sheets("Sheet1").Select
        ElseIf ThisValue = 0 Then
            Range("B" & x & ":F" & x).Copy
            Sheets("test").Select
            Nextrow = Range("A65536").End(xlUp).Row + 1
            Range("A" & Nextrow).Select
            ActiveSheet.Paste
            Sheets("Sheet1").Select

        End If
    Next x
End Sub


the problem is the "Range(col & x)"
They enter a number and it should search row 2 and find that string (it will only appear once) and then it needs to get the column name (A, B, C, D...etc) and that var will be col...just not sure how to do it so atm i have done a little example where it will only work for values 40 - 53 and its a IF statement which changes the col var:
If strweek = 40 Then
col = "AT"
ElseIf strweek = 41 Then
col = "AU"
ElseIf strweek = 42 Then
col = "AV"
ElseIf strweek = 43 Then
col = "AW"
ElseIf strweek = 44 Then
col = "AX"
etc


im sure there is a way to do this auto but cant seem to find a solution :S.
Edited by sniperkid on 31.05.2006 12:08:18
private message Website
Caesum
groupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
I'm not really sure what you're doing here, but generally when programming in Excel it's easier to use things like cells(row,col).value and to find the last row I normally use usedrange.rows.count to compute it.
private message EMail Website
sniperkid
groupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmastergroupmaster
Thanks to aceldama i have solved this little problem -_-.
private message Website
aceldama
groupmastergroupmastergroupmastergroupmaster
oh, it worked? you never told me! glad to be of service though... :clap:
private message

Topic: "Any excel wizards here ?" (page 1 of 1)

1