Compile error

Mike Guest98

New Member
Joined
Jun 4, 2018
Messages
42
I'm been trying to find out what wrong with my code (In sht.Range....) but I don't see it. Can anyone help me?

Thanks so much

<code class="western"> ‘</code><code class="western">Move the cell contents to the next cell</code><code class="western"> </code>
<code class="western"> In sht.Range("E1:E12,B16:B30,E16:E30,H16:H30,K16:K30,N16:N30").Cells</code>

<code class="western"> </code><code class="western">tmp = cell.Offset(0, 1).Value</code>

<code class="western"> </code><code class="western">If cell.Value = n And tmp Like "*#-#*" Then</code>
<code class="western"> </code><code class="western">Cells(irow + 1, icol).Insert Shift:=xlDown</code>
<code class="western"> </code><code class="western"> Cells(irow, icol).Copy Cells(irow + 1, icol)</code>
<code class="western"> </code><code class="western"> Cells(irow, icol).Clear</code> <style type="text/css">pre { direction: ltr; color: rgb(0, 0, 10); text-align: left; }pre.western { font-family: "Liberation Mono", serif; }pre.cjk { font-family: "WenQuanYi Micro Hei Mono"; }pre.ctl { font-family: "Liberation Mono"; }p { margin-bottom: 0.1in; direction: ltr; color: rgb(0, 0, 10); line-height: 115%; text-align: left; }p.western { font-family: "Liberation Serif", serif; font-size: 12pt; }p.cjk { font-family: "WenQuanYi Micro Hei"; font-size: 12pt; }p.ctl { font-family: "Lohit Devanagari"; font-size: 12pt; }code.western { font-family: "Liberation Mono", serif; }code.cjk { font-family: "WenQuanYi Micro Hei Mono"; }code.ctl { font-family: "Liberation Mono"; }</style>
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
What is your objective, to loop through the range?

Code:
In sht.Range("E1:E12,B16:B30,E16:E30,H16:H30,K16:K30,N16:N30").Cells
is not the proper way to start a loop

Possibly
Code:
for each cell in Range("E1:E12,B16:B30,E16:E30,H16:H30,K16:K30,N16:N30").Cells
if cell= something then
'do something'
end if
next cell
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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
Back
Top