View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JuniperTree JuniperTree is offline
external usenet poster
 
Posts: 3
Default Seeking some VB code help.

I'm trying to do the following:

iGroupNum = variable

IF (the right 2 digits of iGroupNum) = "01" or "02" then
If (the right 2 of iGroupNum) = "01" then
iGroupNum = whatever is left minus the 2 right digits (i.e.
3001 would be igroupnum= 30) * 2
Else If (the right 2 digits of iGroupNum) = "02" then
iGroupNumb= whatever is left minus the 2 right digits * 2 + 1
End If
Else (the right 2 digits of iGroupNum < "01" or "02" then
iGroupNum = iGroupNum* 2
End If

Essentially, I'm trying to move cells from one page with a designated
group number to another page. They will go into every other row except
for when the right 2 digits of the designated group number is "01" or
"02". In this case they will end up in consecutive rows.

So far I have:

If Right(iGroupNum, 2) = "01" Or "02" Then
If Right(iGroupNum, 2) = "01" Then
iGroupNum = Left(iGroupNum, Len(iGroupNum) - 2) * 2
Else
iGroupNum = iGroupNum * 2 + 1
End If
End If

If Right(iGroupNum, 2) < "01" Or "02" Then
iGroupNum = iGroupNum
End If

Unfortunately the code is going into the first IF statement even if
iGroupNum = 2 (should only go in if it were 201 or 202)
End If

Help?
Newbie VB gal.