All I want to do is to "scatter" the numbers from 0 to 9 inside a NumPad like the Pin Number Pads I saw on the internet.
So far, this is my code:
Private Sub Command3_Click()
For i = 0 To 9
Command1(i).Caption = Int(10 * Rnd)
Next i
End Sub
wherein Command1(i) is the name of each number buttons I have. Each of them has an index equal to their caption, for now. (Well, there isn't really a dependence between the caption and the index, so let's just leave it at that)
Now, as I said, I want to scatter the numbers or rearrange the numbers, and that's why I have that code.
Do you have a better suggestion on this? :/ I just can't get it. I scanned Google for "No Duplication Random numbers" thingy but I just can't get it.
Oh, in case you'll worry about the whole pin number pad program wherein you don't see any labels or text boxes or whatever, just ignore it. I just want what I'm aiming for now.
Related
I want to make it so if all of the cells in a row has data that matches, it will automatically change the row's fill color to green.
Example of the desired visual effect, including my conditional formatting work-around to achieve the look
As you can see in the image, the rows that have empty cells are not colored green.
Some other functionality I would also appreciate:
Make a row recolor to red if it contains cells that have mismatching data. (such as someone putting their name in someone else's row)
If data is added to a previously empty row, expand the Protected Range by 1 row after 30 minutes.
If a row within a Protected Range becomes empty, the Protected Range automatically sorts itself from A-Z by Column A and reduces its size by 1 row.
Context:
I've recently made a spreadsheet on Google Sheets for my guild in an MMO to track what professions and recipes everyone has, people with the link can perform edits on the sheet, but I do have protected ranges that cover older entries which have their editor access restricted to a small team so random people don't just delete all the data. None of the other officers that regularly maintain the spreadsheets we use have much experience with spreadsheets, which are pretty basic with little automation. It takes three to four of them to do my job when I'm on vacation despite teaching each of them how to maintain the spreadsheets. More automation would be nice for when I go on vacation and eventually retire from that MMO.
This is my first post on this site, I don't know computer programming, not that well-versed with spreadsheets, and trying to google this didn't help since everything I found talked about conditional formatting based on the columns, not the rows.
For now my temporary work-around is to manually add conditional formatting to a range each time I see a row has filled up to change the fill color to green if the cell contains exactly that person's name. Based on prior experience with my guild's other spreadsheets, I know the other officers would not do this themselves.
I'm not sure where to look for help with Google Sheets, but I have a family member that is a developer and I vaguely remember him mentioning this site which is why I'm giving it a shot.
try:
=SUMPRODUCT($A2:$K2<>"")=11
on range A2:K
update:
=(SUMPRODUCT($A2:$R2=$A2)=18)*(A2<>"")
on range A2:R
I currently know how many labels I want to print and use ^PQ# to print that amount but the trouble is getting an incrementing count printed on the corner of each label.
There are a couple problems right now. First is that Zebra doesn't have anything letting me print the odometer value on the zebra printer. It will kind of let me print the number of centimetres or inches using ~WQOD, but it comes with a lot of extra information that I don't want. I couldn't find any commands in the manual just letting me print the number of labels with the reset-able odometer.
I could create a counter outside of the printer then send a request to print each label with a new number on the top right, however, that overloads the printer and causes connection issues with the printer if I print too many labels.
Are there any ways to overcome either of those issues so I can print an incrementing counter on each label?
The command to print a sequence of numbers across labels is ^SN. It is specifically used with ^PQ.
^SN001,1,N^FS
^PQ3
To not overload the printer, send all individual labels within one connection, as a single string stream, don't open a separate connection for each.
I've very limited knowledge of PowerPoint but have been asked to create a presentation slide where I would have to click areas on a map and that would change color and increment a number (population). I am able to change the color of the map on click and I'm able to display a bubble but I am not able to increment the population number based on the areas of the map that are clicked.
I've looked at some solutions around here and did some research online but couldn't find anything that would point me in the right direction.
Is there a way to create a variable and pass a number when you click a specific area of the map, which is a Freeform.
Thank you in advance for the help.
You can set each shape's Action Setting to Run Macro: (macro name)
That will run the VBA subroutine called (macro name) when you click on the shape during a slide show.
Mac PowerPoint has a few bugs that keep this from working as smoothly as it does in Windows PowerPoint but the code below works around these issues and works in either version.
Sub IncrementNumber(oSh as Shape)
Dim oSl as Slide
Dim oShTemp as Shape
' oSh.Parent returns a valid reference to the shape's host slide:
Set oSl = ActivePresentation.Slides(oSh.Parent.SlideIndex)
' and oSh.Name works as well
' So we use those two bits to get a reference
' to the clicked shape like so
Set oShTemp = oSl.Shapes(oSh.Name)
With oShTemp
.TextFrame.TextRange.Text = _
Cstr(CLng(oShTemp.TextRange.Text) + 1)
End With
End Sub
About this bit:
Cstr(CLng(oShTemp.TextRange.Text) + 1)
This gets the current text in the shape, converts it from text (string) to a number so we can do arithmetic on it, adds 1 to it, then converts it back to text so we can plug it back into the shape's text.
If you don't know what to do with VBA code examples, there's a tutorial on the PowerPoint FAQ site that I maintain:
How do I use VBA code in PowerPoint
http://www.pptfaq.com/FAQ00033_How_do_I_use_VBA_code_in_PowerPoint.htm
Here is my code that I tried for the above question and I could only figure out the first part.
`im=imread('sam.jpg');
[h,w]=size(im);
a1=0*im; %For First Part
imshow('bck.jpg');
for i1=1:1:uint16(h/2)
for j1=1:1:i1
temp1=im(i1,j1);
a1(i1,j1)=temp1;
end
end
subplot(2,4,1)
imshow(a1)`
After this I am not able to make other parts as the full black image is shown. Please help regarding this.
Example: original picture
First slice
So I have a 6x4 arrangement of picture boxes drawn on my form. My idea is to create a matching game. I want to add images to the picture boxes randomly each time so that they're not in the same position each time someone plays the game. The images will be stored in a file somewhere on my computer. I'm kind of lost at how to approach this. So far I have:
Public Class Board
Dim cards(23) As Image
Dim random As New Random
Public Sub shuffle()
For i = 0 To cards.Length - 1
cards(i) = i
Next i
End Sub
End Class
This hasn't really gotten me anywhere. I'm kinda new to using VB for things like this so I'd appreciate any suggestions. Also, the pictures that will be matched aren't exactly the same so I want to add 24 images and not 12 images x 2. Eventually I'll have to figure out the conditions for matching but for now I just want to be able to fill the boxes. And I was wondering if it's worth using OOP or is this not complex enough for that. Thanks in advance.